/**
 * @desc 赛事执行-资格审核
 * @author yd_zhaorongjun
 */
<template>
  <div>
    <div class="demo-input-suffix gl_searchBox">
      <el-row :gutter="20">
        <!-- 按状态 -->
        <el-col :md="6" :lg="4">
          <p>{{ $t('search.state') }}</p>
          <el-select v-model="Api_GET_EventsManagementEntryByPersonForAdminQO.CompRegisterApproveStatusCode" size="mini" :placeholder="$t('search.placeholder_State')" filterable @change="refreshList()">
            <template v-for="item in dictAll.competitionApproveStatus">
              <el-option v-if="item.code!='UnderReview'" :key="item.code" :value="item.code" :label="item.value" />
            </template>
          </el-select>
        </el-col>
        <!-- 按机构 -->
        <el-col :md="6" :lg="4">
          <p>按机构</p>
          <el-select v-model="Api_GET_EventsManagementEntryByPersonForAdminQO.DelegationId" size="mini" placeholder="按机构" filterable clearable @change="refreshList()">
            <el-option label="全部" value="" />
            <el-option v-for="item in delegationList" :key="item.id" :label="item.name" :value="item.id" />
          </el-select>
        </el-col>
        <!-- 项目级别 -->
        <el-col :md="6" :lg="4">
          <p>按项目级别</p>
          <el-cascader ref="cascader" v-model="cascaderDataList" :options="cascaderEventList" :props="{ value: 'id', label: 'name',checkStrictly: true }" placeholder="请选择项目级别" size="mini" style="width: 100%;" @change="changeCascader" />
        </el-col>
        <!-- 人员 -->
        <el-col :md="6" :lg="4">
          <p>人员</p>
          <el-input v-model="Api_GET_EventsManagementEntryByPersonForAdminQO.Filter" placeholder="人员" size="mini" clearable @change="refreshList()" />
        </el-col>
        <el-col :md="6" :lg="4">
          <!-- 查询按钮 -->
          <el-button style="margin-top:27px" type="primary" size="mini" @click="refreshList()">{{ $t('button.query') }}</el-button>
          <!-- 重置按钮 -->
          <el-button style="margin-top:27px" type="warning" size="mini" @click="refreshSearchForm">{{ $t('button.Reset') }}</el-button>
        </el-col>
      </el-row>
    </div>
    <template>
      <div v-loading="drawLoading" :element-loading-text="drawLoadingText">
        <el-row class="gl_my_15">
          <!-- 添加选手 -->
          <!-- <el-col :md="24" :lg="13" :xl="12"> -->
          <el-button type="success" size="mini" @click="clickTypeSelect()">添加报项</el-button>
          <el-button type="primary" size="mini" @click="clickBatchPass('batch')">批量通过</el-button>
          <el-button type="primary" plain size="mini" @click="clickBatchNoPass('batch')">批量不通过</el-button>
          <el-button type="primary" size="mini" @click="clickAllPass('All')">一键全部通过</el-button>
          <el-button type="primary" plain size="mini" @click="clickAllNoPass('batch')">一键全部不通过</el-button>
          <!-- </el-col> -->
          <!-- <el-col :md="24" :lg="11" :xl="12" style="text-align:right;line-height:34px"> -->
          <div class="gl_fr" style="text-align:right;" v-loading="downloadResultLoading">
            <div class="pdf_btn" @click="downExcelEntryChange('ComRegisterEntryChange')">
              <img class="PDFimg" src="@/assets/images/EXE.svg" alt="">
              <span>生成级别变更表</span>
            </div>
            <div class="pdf_btn gl_ml_30" @click="downLoadLevelChange('CompetitionRegister')">
              <img class="PDFimg" src="@/assets/images/EXE.svg" alt="">
              <span>生成资格审查不通过表</span>
            </div>
            <div class="pdf_btn gl_ml_30" @click="comRecord('EntryListByNOC')">
              <img class="PDFimg" src="@/assets/images/PDF.svg" alt="">
              <span>按机构生成报名表</span>
            </div>
            <div class="pdf_btn gl_ml_30 " @click="comRecord('EntryListByEvent')">
              <img class="PDFimg" src="@/assets/images/PDF.svg" alt="">
              <span>按级别生成报名表</span>
            </div>
          </div>
          <!-- </el-col> -->
        </el-row>
        <el-table v-loading="loading" :data="tableData" stripe size="mini" style="width: 100%;" @selection-change="selection">
          <el-table-column type="selection" label-class-name="selection" />
          <!-- 序号 -->
          <el-table-column type="index" label="序号" align="center" width="50" />
          <!-- 运动员头像 -->
          <el-table-column label="头像" align="center" width="85">
            <template slot-scope="{row}">
              <img class="athletePhoto" :src="getStaticFileUrl(row.sourceRegister && row.sourceRegister.imagePath)" alt="" @error="errorPhoto">
            </template>
          </el-table-column>
          <!-- 姓名 -->
          <el-table-column prop="sourceRegister.name" label="姓名" width="90" />
          <!-- 性别 -->
          <el-table-column label="性别" width="50" align="center">
            <template slot-scope="{row}">
              <div v-for="item in dictAll.gender" :key="item.code">
                {{ item.code === row.sourceRegister.genderCode ? item.value: '' }}
              </div>
            </template>
          </el-table-column>
          <!-- 出生日期 -->
          <el-table-column label="出生日期" width="85" align="center">
            <template slot-scope="{row}">
              <span v-if="row.sourceRegister && row.sourceRegister.birthDate">
                {{ row.sourceRegister.birthDate | FormatDate('yyyy-MM-dd') }}
              </span>
            </template>
          </el-table-column>
          <!-- 证件号 -->
          <el-table-column prop="sourceRegister.idCardNumber" label="证件号" width="145" align="center" />
          <!-- 所属机构 -->
          <el-table-column prop="delegation.name" label="所属机构" width="120">
            <template slot-scope="{ row }">
              <el-tooltip class="item" effect="dark" :content="row.delegation && row.delegation.name ? row.delegation.name : ''" placement="top">
                <div class="gl_7_ellipsis">{{ row.delegation && row.delegation.name ? row.delegation.name : '' }}</div>
              </el-tooltip>
            </template>
          </el-table-column>
          <!-- 审查状态 -->
          <el-table-column label="审查状态" align="center" width="100">
            <template slot-scope="{row}">
              <span v-if="row.approveStatusCode == 'ApproveSuccess'" class="gl_color_success">
                <i class="el-icon-success" />
                <span class="gl_pl_5">{{ row.approveStatus && row.approveStatus.name ? row.approveStatus.name : '' }}</span>
              </span>
              <span v-if="row.approveStatusCode == 'ApproveFailed'" class="gl_color_error">
                <i class="el-icon-error" />
                <span class="gl_pl_5">{{ row.approveStatus && row.approveStatus.name ? row.approveStatus.name : '' }}</span>
              </span>
              <span v-if="row.approveStatusCode == 'NotApproved'" class="gl_color_grey">
                <i class="el-icon-remove" />
                <span class="gl_pl_5">{{ row.approveStatus && row.approveStatus.name ? row.approveStatus.name : '' }}</span>
              </span>
            </template>
          </el-table-column>
          <!-- 项目名称 -->
          <el-table-column label="项目名称" min-width="180">
            <template slot-scope="{row}">
              <div v-for="item in row.entrys" :key="item.id">{{ item.event.longName }}{{ item.weightClass && item.weightClass.name ? ' (' + item.weightClass.name + ') ' : '' }}{{ item.teamNo ? item.teamNo + "组" : '' }}
              </div>
            </template>
          </el-table-column>
          <!-- 报名赛区 -->
          <el-table-column prop="subCompetition.name" label="报名赛区" width="130" />
          <!-- 审核不通过原因 -->
          <el-table-column label="审核不通过原因" :tooltip="true" width="210">
            <template slot-scope="{row}">
              <el-popover placement="top" width="500" trigger="hover">
                <div style="text-align:left;">
                  <span>{{ row.approveReasonDes }}</span>
                </div>
                <span slot="reference" class="gl_ellipsis" style="width:200px;display:inline-block;vertical-align: middle;">{{ row.approveReasonDes }}</span>
              </el-popover>
            </template>
          </el-table-column>
          <!-- 操作 -->
          <el-table-column fixed="right" :label="$t('table.actions')" width="270">
            <template slot-scope="{row}">
              <template>
                <!-- 编辑按钮 -->
                <el-button v-if="row.hasPerson" size="mini" type="text" @click="editAthlete(row)">
                  {{ $t('table.edit') }}
                </el-button>
                <!-- 更换赛区 -->
                <el-button v-if="parentId && isFinal" size="mini" type="text" @click="openSubCompetition(row)">
                  更换赛区
                </el-button>
              </template>
              <!-- 查看资料 -->
              <el-button size="mini" type="text" @click="checkFile(row)">
                查看资料
              </el-button>
              <!-- 更换组员 -->
              <el-button v-if="row.hasTeam" size="mini" type="text" @click="changePersonOfTeam(row)">
                更换组员
              </el-button>
              <template>
                <!-- 通过按钮 -->
                <el-button v-if="row.approveStatusCode != 'ApproveSuccess'" size="mini" type="text" @click="clickEnable(row)">
                  <span class="gl_color_warning">通过</span>
                </el-button>
                <!-- 不通过按钮 -->
                <el-button v-if="row.approveStatusCode != 'ApproveFailed'" size="mini" type="text" @click="clickDisable(row)">
                  <span class="gl_color_warning">不通过</span>
                </el-button>
              </template>
            </template>
          </el-table-column>
        </el-table>
        <el-row class="gl_pt_20" style="text-align: center;">
          <el-pagination
            :current-page="Api_GET_EventsManagementEntryByPersonForAdminQO.Page"
            :page-size="Api_GET_EventsManagementEntryByPersonForAdminQO.MaxResultCount"
            :total="totalPage"
            layout="total,sizes,prev,pager,next,jumper"
            :page-sizes="[10, 20, 30, 40]"
            @size-change="sizeChange"
            @current-change="pageIndexChange"
          />
        </el-row>
      </div>
    </template>
    <!-- 报项选择弹框 -->
    <el-dialog title="报项选择" class="gl_dialog_TitleLine" :visible.sync="dialogVisible_typeSelect" :close-on-click-modal="false" width="660px">
      <el-row :gutter="40" type="flex" justify="center" style=" height:240px;margin-top:50px;">
        <el-col :span="9">
          <el-card shadow="hover" class="typeSelect_card" @click.native="addAthlete('person')">
            个人报项
          </el-card>
        </el-col>
        <el-col :span="9">
          <el-card shadow="hover" class="typeSelect_card" @click.native="addAthlete('team')">
            团体报项
          </el-card>
        </el-col>
      </el-row>
    </el-dialog>
    <!-- 添加报项弹框 -->
    <el-dialog title="添加报项" class="gl_dialog_TitleLine" :visible.sync="dialogVisible_player_new" :close-on-click-modal="false" width="1000px">
      <el-scrollbar v-loading="dialogLoading" wrap-class="scrollbar-wrapper gl_dialog_height fixHeight">
        <el-form ref="EventsManagementEntryVO" class="gl_form_mini" :model="EventsManagementEntryVO" :rules="EventsManagementEntry_Rules" label-position="right" label-width="120px" style="padding-right: 20px;">
          <el-row :gutter="40">
            <el-col :span="10" class="leftBox">
              <el-row>
                <el-col v-if="typeSelect === 'team'" :span="24">
                  <!-- 所属机构 -->
                  <el-form-item label="所属机构">
                    <el-autocomplete
                      v-model="EventsManagementEntryVO.institutionName"
                      style="width:100%"
                      value-key="name"
                      :fetch-suggestions="querySearchDelegation"
                      :trigger-on-focus="false"
                      size="mini"
                      clearable
                      placeholder="请输入所属机构"
                      @select="handleSelectDelegation"
                      @change="changeDelegation"
                    />
                  </el-form-item>
                </el-col>
                <el-col v-if="typeSelect === 'team'" :span="24">
                  <!-- 姓名 -->
                  <el-form-item label="姓名">
                    <el-autocomplete
                      v-model="EventsManagementEntryVO.playerName"
                      style="width:100%"
                      value-key="name"
                      :fetch-suggestions="querySearchAthlete"
                      :trigger-on-focus="false"
                      size="mini"
                      clearable
                      placeholder="请输入姓名"
                      @select="handleSelectAthlete"
                      @change="changeAthlete"
                    />
                  </el-form-item>
                </el-col>
                <el-col v-if="typeSelect === 'team'" :span="24">
                  <!-- 身份证号 -->
                  <el-form-item label="身份证号">
                    <el-input v-model="EventsManagementEntryVO.idCardNumber" placeholder="请输入身份证号" clearable type="text" size="mini" />
                  </el-form-item>
                </el-col>
                <el-col v-if="typeSelect === 'person'" :span="24">
                  <!-- 姓名 -->
                  <el-form-item label="姓名">
                    <el-input v-model="EventsManagementEntryVO.playerName" placeholder="请输入姓名" clearable type="text" size="mini" @change="getPersonByIdCard()" />
                  </el-form-item>
                </el-col>
                <el-col v-if="typeSelect === 'person'" :span="24">
                  <!-- 证件类型 -->
                  <el-form-item label="证件类型">
                    <el-select v-model="EventsManagementEntryVO.idCardCode" style="width:100%" size="mini" placeholder="请选择" @change="getPersonByIdCard()">
                      <el-option v-for="item in dict.idCardType" :key="item.code" :value="item.code" :label="item.value" />
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col v-if="typeSelect === 'person'" :span="24">
                  <!-- 证件号 -->
                  <el-form-item label="证件号">
                    <el-input v-model="EventsManagementEntryVO.idCardNumber" placeholder="请输入证件号" clearable type="text" size="mini" @change="getPersonByIdCard()" />
                  </el-form-item>
                </el-col>
                <el-col :span="24">
                  <!-- 显示头像 -->
                  <el-form-item label="头像">
                    <div class="uploadBox">
                      <img class="uploadBox_people" :src="getStaticFileUrl(EventsManagementEntryVO.imagePath)" alt="" @error="errorPhoto">
                    </div>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-col>
            <el-col :span="14">
              <el-row class="testingBtn_box">
                <el-col :span="8">
                  <!-- 报名信息检测 -->
                  <el-button :disabled="isDisabled" type="warning" size="mini" @click="signUpTesting">报名信息检测</el-button>
                </el-col>
                <el-col :span="16" style="padding-top:10px">
                  <span>点击报名信息检测，选择符合的项目</span>
                </el-col>
              </el-row>
              <el-row v-if="eventList.length > 0" v-loading="testingLoading" class="gameListBox">
                <!-- 只有联赛显示 -->
                <el-col v-if="parentId && isFinal" :span="24">
                  <el-form label-position="right" label-width="170px">
                    <el-form-item label="可选赛区:">
                      <el-select v-if="radioList.length > 0" v-model="subCompetitionRadioData" placeholder="请选择赛区" style="width:60%" size="mini">
                        <el-option v-for="(item, index) in radioList" :key="index" :label="item.competitionName" :value="item.id" />
                      </el-select>
                      <span v-else>暂无可选择的赛区</span>
                    </el-form-item>
                  </el-form>
                </el-col>
                <el-col v-for="(item, index) in eventList" :key="item.eventCategoryId" :span="24">
                  <!-- 项目列表下拉框 -->
                  <el-form-item :label="item._eventName" :title="item._eventName" label-width="170px" class="event_select">
                    <el-select v-model="signUpList[index]" style="width:45%" size="mini" :title="getTitle(signUpList[index], item.data)" @change="changeSelectEvent(item, index)">
                      <el-option v-for="jtem in item.data" :key="jtem.id" :label="jtem && jtem.eventLongName" :value="jtem.id" />
                    </el-select>
                    <!-- 当该下拉是团体 && 队伍数组length > 0 && 不是不参加选项 -->
                    <!-- <el-select
                      v-if="item.data[1].eventRegTypeCode !== 'I'
                        && signUpTeamNo[index]._list.length > 0
                        && signUpList[index] != ''"
                      v-model="signUpTeamNo[index].num"
                      class="gl_ml_10"
                      style="width:20%"
                      size="mini"
                      @change="changeSelectNum($event, index)"
                    >
                      <el-option v-for="jtem in signUpTeamNo[index]._list" :key="jtem" :label="jtem" :value="jtem" />
                    </el-select> -->
                    <!-- <el-button v-if="item.data[1].eventRegTypeCode !== 'I' && signUpList[index] != ''" type="text" style="padding: 9px 0 0 10px" @click="teamSignUp(signUpList[index], item, index)">+团体报名</el-button> -->
                    <el-button v-if="item.data[1].eventRegTypeCode !== 'I' && signUpList[index] != ''" type="text" style="padding: 9px 0 0 10px" @click="teamSignUp(signUpList[index], item, index)">+团体报名</el-button>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row v-else v-loading="testingLoading" class="gameListBox">
                <div class="gl_noData_mockTable">
                  <p>暂无可报项的数据</p>
                </div>
              </el-row>
            </el-col>
          </el-row>
        </el-form>
      </el-scrollbar>
      <span slot="footer" class="dialog-footer">
        <!-- 取消按钮 -->
        <el-button size="mini" @click="dialogVisible_player_new = false">{{ $t('button.cancel') }}</el-button>
        <!-- 保存按钮 -->
        <el-button type="primary" :loading="submitLoading" size="mini" @click="saveNew()">{{ $t('button.save') }}</el-button>
      </span>
    </el-dialog>
    <!-- 编辑选手弹框 -->
    <el-dialog title="编辑" class="gl_dialog_TitleLine" :visible.sync="dialogVisible_player_edit" :close-on-click-modal="false" width="550px">
      <el-scrollbar v-loading="dialogLoading" wrap-class="scrollbar-wrapper gl_dialog_height">
        <el-form ref="playerDTO_edit" class="gl_form_mini gl_dialog_height" label-position="right" label-width="120px" style="padding-right: 20px;">
          <el-row :gutter="20" style="width:100%;margin:0 auto">
            <el-col v-for="(item, index) in eidtEventListData.eidtEventOlds" :key="index" :span="24">
              <!-- 项目列表下拉框 -->
              <el-form-item :label="item.longName" label-width="200px" :title="item.longName" class="event_select">
                <el-select v-model="item.newEventId" style="width:95%" size="mini">
                  <el-option v-for="jtem in item.eidtEventList" :key="jtem.id" :label="jtem.eventLongName" :value="jtem.id" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </el-scrollbar>
      <span slot="footer" class="dialog-footer">
        <!-- 取消按钮 -->
        <el-button size="mini" @click="dialogVisible_player_edit = false">{{ $t('button.cancel') }}</el-button>
        <!-- 保存按钮 -->
        <el-button type="primary" :loading="submitLoading_Edit" size="mini" @click="editEntry()">{{ $t('button.save') }}</el-button>
      </span>
    </el-dialog>

    <!-- 更换赛区弹框 -->
    <el-dialog title="更换赛区" class="gl_dialog_TitleLine" :visible.sync="dialogVisible_subCompetition" :close-on-click-modal="false" width="550px">
      <el-form v-loading="dialogLoading" class="gl_form_mini" label-position="right" label-width="120px" style="padding-right: 20px;">
        <el-form-item label="选择赛区" label-width="140px" class="event_select">
          <el-select v-if="radioList.length > 0" v-model="subCompetitionQO.subCompetitionId" placeholder="请选择赛区" style="width:80%" size="mini">
            <el-option v-for="(item, index) in radioList" :key="index" :label="item.competitionName" :value="item.id" />
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <!-- 取消按钮 -->
        <el-button size="mini" @click="dialogVisible_subCompetition = false">{{ $t('button.cancel') }}</el-button>
        <!-- 保存按钮 -->
        <el-button type="primary" :loading="submitLoading" size="mini" @click="saveSubCompetition()">{{ $t('button.save') }}</el-button>
      </span>
    </el-dialog>

    <!-- 查看资料弹框 -->
    <el-dialog title="查看资料" class="gl_dialog_TitleLine" :visible.sync="dialogVisible_file" :close-on-click-modal="false" width="880px">
      <el-scrollbar v-loading="dialogLoading" wrap-class="scrollbar-wrapper gl_dialog_height fixHeight">
        <el-row v-if="srcList.length > 0">
          <el-col v-for="(item,index) in srcList" :key="index" class="fileImgBox">
            <el-image :key="index" class="fileImg" :src="getStaticFileUrl(srcList[index].fileDir)" :preview-src-list="srcList_big" @click="EnlargePicture(index)" />
          </el-col>
        </el-row>
        <div v-else class="gl_noData_mockTable">
          <p>暂无数据</p>
        </div>
      </el-scrollbar>
      <span slot="footer" class="dialog-footer">
        <!-- 确定 -->
        <el-button type="primary" size="mini" @click="dialogVisible_file = false">{{ $t('table.confirm') }}</el-button>
      </span>
    </el-dialog>

    <!-- 更换组员弹框 -->
    <el-dialog title="更换组员选择" class="gl_dialog_TitleLine" :visible.sync="dialogVisible_group" :close-on-click-modal="false" width="600px">
      <el-row :gutter="40" type="flex" justify="center">
        <template>
          <el-radio-group v-model="groupRadio" @change="changeGroupRadio">
            <li v-for="(data, index) in groupRadioList" :key="index" style="height:26px">
              <el-radio class="radio" :label="data.radioItem.id">
                <el-popover placement="bottom" width="300" trigger="hover" :content="data.radioItem.longName">
                  <span slot="reference" class="gl_ellipsis">{{ data.radioItem.longName }}</span>
                </el-popover>
              </el-radio>
            </li>
          </el-radio-group>
        </template>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <!-- 取消按钮 -->
        <el-button size="mini" @click="dialogVisible_group = false">{{ $t('button.cancel') }}</el-button>
        <!-- 保存按钮 -->
        <el-button type="primary" :loading="submitLoading" size="mini" @click="checkGroup()">下一步</el-button>
      </span>
    </el-dialog>
    <!-- 更换人员弹框 -->
    <el-dialog :title="personOfTeam_title" class="gl_dialog_TitleLine" :visible.sync="dialogVisible_PersonOfTeam" :close-on-click-modal="false" width="1500px">
      <el-form ref="playerDTO_PersonOfTeam" v-loading="dialogLoading_PersonOfTeam" class="gl_form_mini" :model="playerDTO_PersonOfTeam" :rules="PlayerDTO_PersonOfTeam_Rules" label-position="right" label-width="120px" style="height:500px">
        <el-row>
          <el-col class="teamName">项目名称: {{ changeGroupTilteName }}</el-col>
        </el-row>
        <el-row class="transferBox" type="flex" justify="center">
          <template>
            <el-transfer
              v-if="dialogVisible_PersonOfTeam"
              v-model="TransferValue"
              :titles="['未报项人员', '已报项人员']"
              :props="{ key: 'id', label: 'name' }"
              :render-content="renderFunc"
              :data="transferData"
            />
          </template>
        </el-row>
        <!-- <el-row class="gl_mt_20 gl_pr_20">
          <el-col v-if="isNew" :span="6" :offset="18">
            <el-form-item label="队伍名称" prop="teamName">
              <el-input v-model="playerDTO_PersonOfTeam.teamName" placeholder="请输入队伍名称" type="text" size="mini" />
            </el-form-item>
          </el-col>
        </el-row> -->
      </el-form>
      <span slot="footer" class="dialog-footer">
        <!-- 取消按钮 -->
        <el-button size="mini" @click="dialogVisible_PersonOfTeam = false">{{ $t('button.cancel') }}</el-button>
        <!-- 保存按钮 -->
        <el-button v-if="isNew" type="primary" :loading="submitLoading_Person" size="mini" @click="saveNewPersonOfTeam(playerDTO_PersonOfTeam.eventId)">确认</el-button>
        <el-button v-else type="primary" :loading="submitLoading_Person" size="mini" @click="savePersonOfTeam()">{{ $t('button.save') }}</el-button>
      </span>
    </el-dialog>
    <!-- 审核不通过弹框 -->
    <el-dialog title="不通过原因" class="gl_dialog_TitleLine" :visible.sync="dialogVisible_ApproveFailed" :close-on-click-modal="false" width="880px">
      <el-scrollbar v-loading="dialogLoading" wrap-class="scrollbar-wrapper gl_dialog_height">
        <el-row class="transferBox" type="flex" justify="center">
          <el-form ref="SiSTKWEventsManagementEntryRegisterApproveInput" class="gl_form_mini gl_mt_30" :model="SiSTKWEventsManagementEntryRegisterApproveInput" label-position="right" style="width: 70%;">
            <el-row :gutter="40" class="gl_mb_20">
              <el-checkbox-group v-model="ApproveFailed_checkList" @change="checkListChange">
                <el-checkbox label="会员证问题" />
                <el-checkbox label="心电图问题" />
                <el-checkbox label="脑电图问题" />
                <el-checkbox label="级位证问题" />
                <el-checkbox label="其他问题" />
              </el-checkbox-group>
            </el-row>
            <el-row :gutter="40">
              <el-input
                v-model="ApproveFailed_textarea"
                type="textarea"
                :autosize="{ minRows: 6, maxRows: 10}"
                placeholder="请输入内容"
                :disabled="ApproveFailed_disabled"
              />
            </el-row>
          </el-form>
        </el-row>
      </el-scrollbar>
      <span slot="footer" class="dialog-footer">
        <!-- 取消按钮 -->
        <el-button size="mini" @click="dialogVisible_ApproveFailed = false">{{ $t('button.cancel') }}</el-button>
        <!-- 保存按钮 -->
        <el-button type="primary" :loading="submitLoading" size="mini" @click="saveApproveFailed()">{{ $t('button.save') }}</el-button>
      </span>
    </el-dialog>

    <TeamCompetition
      ref="refTeamCompetitionMember"
      :title="teamCompetitionTitle"
      :require-member="mainMember"
      :ignore-check="true"
      :gameInfo = 'gameInfo'
      :team-entry="teamCompetitionTeamEntry"
      :option-member="teamCompetitionLeftList"
      :max-select-member-num="teamCompetitionMaxCount"
      :min-select-member-num="teamCompetitionMinCount"
      :select-member="teamCompetitionRightList"
      @onTeamCompetitionSubmit="onTeamCompetitionSubmit"
      @onDeleteGroupMember="onDeleteGroupCompetition"
    />

    <TeamNoneCompetition
      ref="refTeamNoneCompetitionMember"
      :title="teamNoneCompetitionTitle"
      :require-member="mainMember"
      :ignore-check="true"
      :gameInfo = 'gameInfo'
      :team-entry="teamNoneCompetitionTeamEntry"
      :option-member="teamNoneCompetitionLeftList"
      :max-select-member-num="teamNoneCompetitionMaxCount"
      :min-select-member-num="teamNoneCompetitionMinCount"
      :select-member="teamNoneCompetitionRightList"
      @onTeamNoneCompetitionSubmit="onTeamNoneCompetitionSubmit"
      @onDeleteGroupMember="onDeleteGroupNoneCompetition"
    />
  </div>
</template>
<script>
import { errorText } from '@/lib';
import { api_GET_DownLoadFileAddHeader } from '@/extend/api/file';
import { mapState, mapActions } from 'vuex';
import { translateByCode } from '@/lib/getTransData';
import { removeSameData } from '@/lib';
import defaultGameLogo from '@/assets/images/face_default.png';
import {
  api_GET_EventsManagementCategory, // 获取项目类别列表
  api_GET_EventsManagementDelegation, // 查询机构列表
  api_GET_EventsManagementEntryDelegationListByCompetitionCompetitionId,
  api_GET_EventsManagementEntryByPersonForAdmin, // 12-1-管理员：查询报项（按个人汇总报项）
  api_GET_EventsManagementEntryDelegationCandidatesForEntry, // 9-获取机构对应赛事可报名人员或项目对应可报名人员
  api_POST_EventsManagementEntryQueryEventsToEntryForRegisters, // 1-获取已存在人员可报的赛事项目列表
  api_POST_EventsManagementEntryForAdmin, // 2-1-管理员：添加报项，可以不包含了教练或领队的报项
  api_GET_EventsManagementComRegisterFileCompetitionEntryFileByRegisterCompetitorRegisterId, // 8-查询体检资料
  api_GET_EventsManagementEntryEntryMemberForTeam, // 8-获取机构某队伍的成员
  api_PUT_EventsManagementEntryTeamMemberForAdmin, // 4.1-管理员更改队伍成员
  api_POST_EventsManagementEntryApproveCompetitionRegisters, // 10-赛事人员报名审核操作
  api_GET_EventsManagementRegister, // 查询注册列表
  api_PUT_EventsManagementEntryForAdmin, // 3-1-管理员：更改队伍或人员的报项，更改队伍成员【注意同类别团体赛应该不允许参加多个队伍】
  api_DELETE_EventsManagementEntryForAdmin, // 5-管理员-删除报项（注意删除全部报项的时候，应该同时删除CompetitionRegister相关内容）
  api_GET_EventsManagementRegisterByIdCard, // 获取会员信息 ByIdCard
  api_GET_EventsManagementEntryTeamEntry, // 获取团体报项
  api_GET_EventsManagementEntryTeamEntryMemberCandidates, // 获取团体报项候选人员列表
  api_POST_EventsManagementEntrySaveTeamEntry2, // 保存团体报项
  api_DELETE_EventsManagementEntryTeamEntry, // 删除团体报项
  api_POST_EventsManagementEntryQuerySubCompetitionsToEntryForRegisters, // 0-获取已存在人员联赛决赛代表的分站赛赛事列表
  api_GET_EventsManagementCompetitionId,
  api_PUT_EventsManagementEntryComRegisterSubCompetition,
  api_GET_EventsManagementCompetitionWithRoute,
} from '@/extend/api/gameswaggerApi/app';
import {
  Api_GET_EventsManagementEntryByPersonForAdminQO, // 表单: 12-查询报项（按个人汇总报项）
  Api_GET_EventsManagementEntryDelegationCandidatesForEntryQO, // 9-获取机构对应赛事可报名人员或项目对应可报名人员
  SiSTKWEventsManagementGetEntryEventsInput, // 1-获取已存在人员可报的赛事项目列表
  SiSTKWEventsManagementCreateEntryInput, //  表单: 2-添加报项，包含了教练或领队便于一次性提交，单个报项(除操作控制外)
  SiSTKWEventsManagementCreateEntrysInput,
  SiSTKWEventsManagementCompetitionRegisterFileDto, // 8-查询体检资料
  // Api_GET_EventsManagementEntryEntryMemberForTeamQO, // 表单: 8-获取机构某队伍的成员
  Api_PUT_EventsManagementEntryForAdminQO, // 表单: 3-1-管理员：更改队伍或人员的报项，更改队伍成员【注意同类别团体赛应该不允许参加多个队伍】
  SiSTKWEventsManagementUpdateTeamMemberInput, // 表单: 4-更改队伍成员==
  SiSTKWEventsManagementEntryRegisterApproveInput, // 10-赛事人员报名审核操作
  Api_PUT_EventsManagementEntryComRegisterSubCompetitionQO
} from '@/lib/form/game/swaggerForm';
import { EventsManagementEntryVO, PlayerDTO_PersonOfTeam, EidtEventListData } from '@/lib/form/game/qualificationForm';
import { EventsManagementEntry_Rules, PlayerDTO_PersonOfTeam_Rules } from '@/lib/validate/execte/index.js';
import TeamCompetition from '@/components/TeamCompetition';
import TeamNoneCompetition from '@/components/TeamNoneCompetition';
export default {
  name: 'Qualification',
  components: {
    TeamCompetition,
    TeamNoneCompetition
  },
  data() {
    return {
    // 穿梭框自定义显示
      renderFunc(h, option) {
        return h(
          'ul',
          {
            class: {
              'transferUl': true
            }
          },
          [
            h(
              'li',
              {
                class: {
                  'transferItem_img': true
                }
              },
              [
                h(
                  'img',
                  {
                    attrs: {
                      src: WEB_CONFIG.VUE_APP_STATIC_FILE_RUL + option.imagePath
                      // src: function(event) {
                      //   const img = event.srcElement;
                      //   img.src = getStaticFileUrl(option.imagePath);
                      // }
                    },
                    on: {
                      'error': function(event) {
                        const img = event.srcElement;
                        img.src = defaultGameLogo;
                      }
                    }
                  }
                )
              ]
            ),
            h(
              'li',
              {
                class: {
                  'transferItem_name': true
                }
              },
              option.name
            ),
            h(
              'li',
              {
                class: {
                  'transferItem_gender': true
                }
              },
              option.genderCode === 'M' ? '男' : option.genderCode === 'W' ? '女' : ''
            ),
            h(
              'li',
              {
                class: {
                  'transferItem_idCard': true
                }
              },
              // option.idCardNumber ? option.idCardNumber : ''
              option.idCardNumber ? '证件号:' + option.idCardNumber : ''
            ),
            // h(
            //   'li',
            //   {
            //     attrs: {
            //       title: option.delegation ? option.delegation.name : ''
            //     },
            //     class: {
            //       'transferItem_institutionName': true
            //     }
            //   },
            //   option.delegation ? option.delegation.name : ''
            //   // option.institutionName ? '机构:' + option.institutionName : '',
            // ),
            h(
              'li',
              {
                class: {
                  'transferItem_phone': true
                }
              },
              // option.phoneNumber ? option.phoneNumber : ''
              option.phoneNumber ? '电话:' + option.phoneNumber : ''
            )
          ]
        );
      },
      transferData: [], // 穿梭框人员数据
      TransferValue: [],
      isNew: true, // 判断是添加选手还是更换组员弹框
      defaultGameLogo: defaultGameLogo,
      personOfTeam_title: '',
      srcList: [],
      srcList_big: [],
      gameId: '', // 分站赛/独立赛
      parentId: '', // 联赛
      delegationId: '', // 机构ID
      teamRegisterId: '', // 队伍id
      // * 表单: 17-查询报项（按个人汇总报项）
      Api_GET_EventsManagementEntryByPersonForAdminQO: new Api_GET_EventsManagementEntryByPersonForAdminQO(),
      // * 表单: 14-获取机构对应赛事可报名人员或项目对应可报名人员
      Api_GET_EventsManagementEntryDelegationCandidatesForEntryQO: new Api_GET_EventsManagementEntryDelegationCandidatesForEntryQO(),
      //  * 表单: 2-添加报项，包含了教练或领队便于一次性提交，单个报项(除操作控制外)
      SiSTKWEventsManagementCreateEntryInput: new SiSTKWEventsManagementCreateEntryInput(),
      CreateEntrysInputDTO: new SiSTKWEventsManagementCreateEntrysInput(),
      // 表单: 1-获取已存在人员可报的赛事项目列表
      SiSTKWEventsManagementGetEntryEventsInput: new SiSTKWEventsManagementGetEntryEventsInput(),
      //  * 表单: 8-查询体检资料
      SiSTKWEventsManagementCompetitionRegisterFileDto: new SiSTKWEventsManagementCompetitionRegisterFileDto(),
      //  * 表单: 10-赛事人员报名审核操作
      SiSTKWEventsManagementEntryRegisterApproveInput: new SiSTKWEventsManagementEntryRegisterApproveInput(),
      // * 表单: 3-更改队伍或人员的报项【注意同类别团体赛应该不允许参加多个队伍】(除操作控制外)
      Api_PUT_EventsManagementEntryForAdminQO: new Api_PUT_EventsManagementEntryForAdminQO(),
      EventsManagementEntryVO: new EventsManagementEntryVO(),
      playerDTO_PersonOfTeam: new PlayerDTO_PersonOfTeam(),
      eidtEventListData: new EidtEventListData(),
      EventsManagementEntry_Rules: new EventsManagementEntry_Rules(),
      PlayerDTO_PersonOfTeam_Rules: new PlayerDTO_PersonOfTeam_Rules(),
      getEntryEventsInput: new SiSTKWEventsManagementGetEntryEventsInput(),
      subCompetitionQO: new Api_PUT_EventsManagementEntryComRegisterSubCompetitionQO(),
      loading: false,
      drawLoading: false,
      drawLoadingText: '',
      dialogLoading: false,
      submitLoading: false,
      submitLoading_Edit: false,
      submitLoading_Person: false,
      dialogLoading_PersonOfTeam: false,
      testingLoading: false, // 报名信息检测按钮
      downloadResultLoading: false,
      dialogVisible_typeSelect: false, // 新增报项的 个人 或 团队 选择框
      dialogVisible_player_new: false,
      dialogVisible_player_edit: false,
      dialogVisible_file: false, // 查看资料弹框控制
      dialogVisible_group: false, // 更换组员选择弹框控制
      dialogVisible_PersonOfTeam: false, // 更换组员弹框控制
      dialogVisible_ApproveFailed: false, // 审核不通过原因弹框
      dialogVisible_subCompetition: false,
      typeSelect: '', // 新增报项的 个人 或 团队 选择
      groupRadio: '', // 选择组员的单选按钮
      currentPage: 1,
      totalPage: 0,
      SelectionList: [], // 选中的数据
      delegationList: [], // 机构列表的下拉数据
      AthleteList: [], // 运动员的下拉数据
      delegationFliter: [], // 筛选后的单位
      athleteFliter: [], // 筛选后的人员
      cascaderEventList: [], // 级联筛选框的下拉数据
      cascaderDataList: [''], // 用于存放级联筛选框选中的数据
      eventList: [], // 编辑里的项目列表
      signUpList: [], // 用于新增报名用
      signUpTeamNo: [],
      maxTeamMembersCount: 0, // 每个团体最多人数(仅在项目类型为团体时设置)
      minTeamMembersCount: 0,
      imgList: [], // 查看资料里的图片列表
      groupRadioList: [], // 更换组弹框
      tableData: [],
      restaurants: [],
      teamName: '', // 队伍名称
      OriginalEventList: '', // 小项的原始数据
      teamDataObj: {}, // 储存报项里的不同团体报项数据
      isDisabled: true, // 控制是否可点击
      changeGroupTilteName: '', // 更换组员里的项目名称显示
      eventId: '',
      http: '',
      teamEntryId: '',
      ApproveFailed_textarea: '',
      ApproveFailed_disabled: true,
      ApproveFailed_checkList: [], // 不通过原因数组
      mainMember: {},
      gameInfo: {},
      gameRouten: {},
      teamCompetitionTitle: '',
      teamCompetitionLeftList: [],
      teamCompetitionRightList: [],
      teamCompetitionMaxCount: 0,
      teamCompetitionMinCount: 0,
      teamCompetitionCurrent: {}, // 当前选中的团体竞技项目
      teamCompetitionTeamEntry: {}, // 获取到的团体报项数据

      teamNoneCompetitionTitle: '',
      teamNoneCompetitionLeftList: [],
      teamNoneCompetitionRightList: [],
      teamNoneCompetitionMaxCount: 0,
      teamNoneCompetitionMinCount: 0,
      teamNoneCompetitionCurrent: {}, // 当前选中的普通团体项目
      teamNoneCompetitionTeamEntry: {}, // 获取到的团体报项数据
      requiredIdData: {},
      indexByList: 0, // 用于团体新增里提交团体报名后去掉该小项
      isTeam: false, // 用于新增报项是团体是否报名的验证
      radioList: [],
      subCompetitionRadioData: '',
      isFinal: false // 是否决赛
    };
  },
  computed: {
    ...mapState({
      cache: state => state.dict.cache,
      dict: state => state.dict.dict,
      dictAll: state => state.dict.dictAll
    }),
    getTitle() { // 下拉绑定Title用
      return function(val, data) {
        if (val !== '') {
          const _data = data.filter(item => item.id === val);
          return _data[0].eventLongName;
        }
      };
    }
  },
  watch: {
    dialogVisible_player_new(val) {
      if (!val) {
        this.$refs['EventsManagementEntryVO'].resetFields();
        this.teamDataObj = {};
        this.isDisabled = true;
        this.refreshList(this.Api_GET_EventsManagementEntryByPersonForAdminQO.Page);
      }
    },
    dialogVisible_PersonOfTeam(val) {
      if (!val) {
        if (Object.keys(this.teamDataObj).length !== 0) {
          this.teamDataObj[this.playerDTO_PersonOfTeam.eventId].TransferValue = this.TransferValue;
        }
        this.$refs['playerDTO_PersonOfTeam'].resetFields();
      }
    },
    ApproveFailed_disabled(val) {
      this.ApproveFailed_textarea = '';
    }
  },
  created() {
    this.gameId = this.$route.params.id;
    this.parentId = this.$route.params.parentId;
    this.gameTenantId = process.env.VUE_APP_Get_TenantId;
    this.getDictByType(['district']);
    this.getDict();
    this.api_GET_EventsManagementCategory();
    this.api_GET_EventsManagementDelegation();
    this.getDelegationList();
    this.refreshList();
    this.getGameRoute();
    if (this.parentId) {
      this.getGameInfo();
    }
  },
  methods: {
    ...mapActions({ getDictByType: 'dict/getDictByType', getDict: 'dict/getDict' }),
    // 获取赛事详情
    getGameInfo() {
      api_GET_EventsManagementCompetitionId(this.gameId).then(res => {
        this.isFinal = res.isFinal;
      }, () => {
        this.$message({ type: 'error', message: '获取赛事详情失败！' });
      });
    },
    getGameRoute() {
      api_GET_EventsManagementCompetitionId(this.gameId).then(res => {
        this.gameRouten = res.route;
        this.getGameInfoByGameRoute();
      }, () => {
        this.$message({ type: 'error', message: '获取赛事详情失败！' });
      });
    },
    // 获取项目类别列表
    api_GET_EventsManagementCategory() {
      const _this = this;
      const data = {
        CompetitionId: _this.gameId,
        IncludeEventGroup: true,
        IncludeEvent: true
      };
      api_GET_EventsManagementCategory(data).then(res => {
        for (let i = 0; i < res.items.length; i++) {
          // eslint-disable-next-line prefer-const
          let item = res.items[i];
          item.children = item.eventGroups;
          for (let j = 0; j < item.children.length; j++) {
          // eslint-disable-next-line prefer-const
            let jtem = item.children[j];
            for (let k = 0; k < jtem.events.length; k++) {
              // eslint-disable-next-line prefer-const
              let ktem = jtem.events[k];
              ktem.name = ktem.longName || ktem.name;
            }
            jtem.children = jtem.events;
          }
        }
        _this.cascaderEventList = [
          {
            id: '',
            name: '全部'
          }
        ];
        _this.cascaderEventList = [..._this.cascaderEventList, ...res.items];
      }, () => {
        _this.$message({ type: 'error', message: '获取项目类别列表失败' });
      });
    },
    // 查询报项机构列表
    api_GET_EventsManagementDelegation() {
      api_GET_EventsManagementDelegation({ IsApproved: null }).then(res => {
        this.restaurants = res.items;
      }, () => {
        this.$message({ type: 'error', message: '获取机构列表失败' });
      });
    },
    // 查询机构列表
    getDelegationList() {
      api_GET_EventsManagementEntryDelegationListByCompetitionCompetitionId(this.gameId).then(res => {
        this.delegationList = res;
      }, () => {
        this.$message({ type: 'error', message: '获取机构列表失败' });
      });
    },
    // 刷新列表
    refreshList(page) {
      const _this = this;
      this.loading = true;
      this.Api_GET_EventsManagementEntryByPersonForAdminQO.CompetitionId = this.gameId;
      this.Api_GET_EventsManagementEntryByPersonForAdminQO.CompRegisterApproveStatusCode = this.Api_GET_EventsManagementEntryByPersonForAdminQO.CompRegisterApproveStatusCode || '';
      this.Api_GET_EventsManagementEntryByPersonForAdminQO.Page = page || 1;
      this.Api_GET_EventsManagementEntryByPersonForAdminQO.SkipCount = (this.Api_GET_EventsManagementEntryByPersonForAdminQO.Page - 1) * this.Api_GET_EventsManagementEntryByPersonForAdminQO.MaxResultCount;
      api_GET_EventsManagementEntryByPersonForAdmin(this.Api_GET_EventsManagementEntryByPersonForAdminQO).then(res => {
        _this.tableData = res.items;
        _this.totalPage = res.totalCount;
        // 判断是否存在团体并显示更换组员按钮
        for (let i = 0; i < _this.tableData.length; i++) {
          // eslint-disable-next-line prefer-const
          let item = _this.tableData[i];
          item.hasTeam = false;
          item.hasPerson = false;
          for (let j = 0; j < item.entrys.length; j++) {
            if (item.entrys[j].event.registerTypeCode !== 'I') {
              item.hasTeam = true;
            } else {
              item.hasPerson = true;
            }
          }
        }
        _this.loading = false;
      })
        .catch(() => {
          _this.loading = false;
        });
    },
    // 重置搜索表单
    refreshSearchForm() {
      this.Api_GET_EventsManagementEntryByPersonForAdminQO = new Api_GET_EventsManagementEntryByPersonForAdminQO();
      this.cascaderDataList = [''];
      this.refreshList();
    },
    // 选中的数据
    selection(val) {
      this.SelectionList = val;
    },
    // 地址栏改变
    changeCascader() {
      this.Api_GET_EventsManagementEntryByPersonForAdminQO.CategoryId = this.cascaderDataList[0] || '';
      this.Api_GET_EventsManagementEntryByPersonForAdminQO.EventGroupId = this.cascaderDataList[1] || '';
      this.Api_GET_EventsManagementEntryByPersonForAdminQO.EventId = this.cascaderDataList[2] || '';
      this.eventId = this.cascaderDataList[2] || '';
      this.refreshList();
    },
    // 获取静态文件
    getStaticFileUrl(relativeUrl) {
      if (!relativeUrl) return '';
      return WEB_CONFIG.VUE_APP_STATIC_FILE_RUL + relativeUrl;
    },
    errorPhoto() {
      const img = event.srcElement;
      img.src = this.defaultGameLogo;
    },
    // 点击图片
    EnlargePicture(index) {
      let a1 = [];
      let a2 = [];
      const imgList = [];
      // if (index > 0) {
      this.srcList.filter(item => {
        imgList.push(this.getStaticFileUrl(item.fileDir));
      });
      a1 = imgList.slice(index);
      a2 = imgList.slice(0, index);
      this.srcList_big = a1.concat(a2);
      // }
    },
    // 编辑按钮
    editAthlete(row) {
      const _this = this;
      _this.dialogVisible_player_edit = true;
      _this.dialogLoading = true;
      _this.eidtEventListData = new EidtEventListData();
      const _promise = [];
      for (let i = 0; i < row.entrys.length; i++) {
        const item = row.entrys[i];
        if (item.event.registerTypeCode === 'I') {
          _this.SiSTKWEventsManagementGetEntryEventsInput = new SiSTKWEventsManagementGetEntryEventsInput();
          _this.SiSTKWEventsManagementGetEntryEventsInput.competitionId = _this.gameId;
          _this.SiSTKWEventsManagementGetEntryEventsInput.registerId = row.sourceRegister.id;
          _this.SiSTKWEventsManagementGetEntryEventsInput.delegationId = null;
          _promise[i] = this.apiEventList(_this.SiSTKWEventsManagementGetEntryEventsInput, item);
        }
      }
      Promise.all(_promise)
        .then(res => {
          _this.dialogLoading = false;
          // 排序一遍
          _this.eidtEventListData.eidtEventOlds.sort((a, b) => {
            const _aCode = a['longName'];
            const _bCode = b['longName'];
            return ((_aCode < _bCode) ? -1 : (_aCode > _bCode) ? 1 : 0);
          });
          console.log(_this.eidtEventListData);
        })
        .catch(error => {
          _this.dialogLoading = false;
          console.log(error);
        });
    },
    // 获取已存在人员可报的赛事项目列表
    apiEventList(vo, entry) {
      const _this = this;
      return new Promise((resolve, reject) => {
        api_POST_EventsManagementEntryQueryEventsToEntryForRegisters(vo)
          .then(
            res => {
              resolve(res);
              _this.Api_PUT_EventsManagementEntryForAdminQO = new Api_PUT_EventsManagementEntryForAdminQO();
              // 报项是团体的时候传团体EntryId
              _this.Api_PUT_EventsManagementEntryForAdminQO.oldEntryId = entry.event && entry.event.registerTypeCode !== 'I' ? entry.teamEntry.id : entry.id;
              _this.Api_PUT_EventsManagementEntryForAdminQO.longName = entry.event.longName;
              // 获取相同registerTypeCode 的数据，并聚合 有 I,D,T三类，I是个人，T是团体，D是双人
              const _list = res.filter(item => item.eventRegTypeCode === entry.event.registerTypeCode && item.eventCategoryId === entry.event.eventGroup.category.id);
              console.log(_list);
              // _list.sort((a, b) => a.eventShortName - b.eventShortName);
              const empty = {
                id: '-1',
                eventLongName: '不参加'
              };
              _list.unshift(empty);
              // _this.Api_PUT_EventsManagementEntryForAdminQO.eidtEventList = [];
              _this.Api_PUT_EventsManagementEntryForAdminQO.eidtEventList = _list;
              _this.eidtEventListData.eidtEventOlds.push(_this.Api_PUT_EventsManagementEntryForAdminQO);
              // _this.eidtEventListData.eidtEventList.push(_list);
            }
          )
          .catch(
            error => {
              const _msg = error.message || error.error.message;
              this.$message({
                duration: 15000,
                showClose: true,
                message: _msg,
                type: 'error'
              });
              reject(error);
            }
          );
      });
    },
    // 修改报项保存按钮
    editEntry() {
      const _this = this;
      _this.submitLoading_Edit = true;
      // eslint-disable-next-line no-unused-vars
      let _isSelect = false; // 判断是否有选择下拉项
      _this.eidtEventListData.eidtEventOlds.filter(item => {
        if (item.newEventId) {
          // eslint-disable-next-line no-const-assign
          _isSelect = true;
        }
      });
      const _promise = [];
      const _deleteList = [];
      if (_isSelect) {
        for (let i = 0; i < _this.eidtEventListData.eidtEventOlds.length; i++) {
          const item = _this.eidtEventListData.eidtEventOlds[i];
          if (item.newEventId) {
            if (item.newEventId !== '-1') {
              _promise[i] = this.apiEventListEdit(item);
            } else {
              _deleteList.push(item.oldEntryId);
            }
          }
        }
        if (_deleteList.length > 0) {
          _promise.push(this.apiEventListDelete(_deleteList));
        }
        Promise.allSettled(_promise)
          .then(res => {
            const state = res.every(item => item.status === 'fulfilled');
            if (state) {
              this.$message({
                duration: 15000,
                showClose: true,
                message: translateByCode('alert.editSuccessfully'),
                type: 'success'
              });
              _this.submitLoading_Edit = false;
              _this.dialogVisible_player_edit = false;
              _this.refreshList(_this.Api_GET_EventsManagementEntryByPersonForAdminQO.Page);
            } else {
              _this.submitLoading_Edit = false;
              _this.dialogVisible_player_edit = false;
              _this.refreshList(_this.Api_GET_EventsManagementEntryByPersonForAdminQO.Page);
            }
          });
      } else {
        this.$message({
          // 请选择报项
          message: '请选择报项',
          type: 'warning'
        });
        _this.submitLoading_Edit = false;
      }
      // }
    },
    // 修改报名接口
    apiEventListEdit(vo) {
      // const _this = this;
      return new Promise((resolve, reject) => {
        console.log('编辑保存', vo);
        var _data = {
          newEventId: '',
          oldEntryId: ''
        };
        _data.newEventId = vo.newEventId;
        _data.oldEntryId = vo.oldEntryId;
        api_PUT_EventsManagementEntryForAdmin(_data)
          .then(
            res => {
              resolve(res);
            }
          )
          .catch(
            error => {
              const _msg = error.error.message || error.message;
              this.$message({
                duration: 15000,
                showClose: true,
                message: `[${vo.longName}] ${_msg} 修改失败 `,
                type: 'error'
              });
              reject(error);
            }
          );
      });
    },
    // 修改报项保存按钮, 选择不参与 （-1） 的时候调删除api
    apiEventListDelete(vo) {
      return new Promise((resolve, reject) => {
        api_DELETE_EventsManagementEntryForAdmin({ ids: vo })
          .then(
            res => {
              resolve(res);
            }
          )
          .catch(
            error => {
              const _msg = error.error.message || error.message;
              this.$message({
                duration: 15000,
                showClose: true,
                message: _msg,
                type: 'error'
              });
              reject(error);
            }
          );
      });
    },
    // 查看资料
    checkFile(row) {
      this.dialogVisible_file = true;
      this.SiSTKWEventsManagementCompetitionRegisterFileDto = new SiSTKWEventsManagementCompetitionRegisterFileDto();
      this.dialogLoading = true;
      this.api_GET_EventsManagementComRegisterFileCompetitionEntryFileByRegisterCompetitorRegisterId(row.id);
    },
    // 查询体检资料
    api_GET_EventsManagementComRegisterFileCompetitionEntryFileByRegisterCompetitorRegisterId(id) {
      api_GET_EventsManagementComRegisterFileCompetitionEntryFileByRegisterCompetitorRegisterId(id).then(res => {
        console.log('查询体检资料', res);
        this.srcList = res;
        this.EnlargePicture();
        this.dialogLoading = false;
      }, () => {
        this.$message({ type: 'error', message: '获取体检资料失败' });
        this.dialogLoading = false;
      });
    },
    // 穿梭框点击事件，右侧列表元素变化时触发
    ChangeTransferData(value, direction, movedKeys) {
      const _this = this;
      if (this.maxTeamMembersCount !== null && value.length >= this.maxTeamMembersCount && direction === 'right') {
        _this.transferData.filter(item => {
          if (value.indexOf(item.id) >= 0) {
            item.disabled = false;
          } else {
            item.disabled = true;
          }
        });
      } else {
        _this.transferData.filter(item => {
          item.disabled = false;
        });
      }
    },
    leftCheck(arr) {
      const _this = this;
      if (this.maxTeamMembersCount !== null && _this.TransferValue.length + arr.length >= this.maxTeamMembersCount) {
        _this.transferData.filter(item => {
          if (_this.TransferValue.indexOf(item.id) >= 0 || arr.indexOf(item.id) >= 0) {
            this.$set(item, 'disabled', false);
          } else {
            this.$set(item, 'disabled', true);
          }
        });
      } else {
        _this.transferData.filter(item => {
          this.$set(item, 'disabled', false);
        });
      }
    },
    // 批量通过按钮
    clickBatchPass() {
      if (this.SelectionList.length > 0) {
        this.SiSTKWEventsManagementEntryRegisterApproveInput = new SiSTKWEventsManagementEntryRegisterApproveInput();
        this.SiSTKWEventsManagementEntryRegisterApproveInput.competitionId = this.gameId;
        this.SiSTKWEventsManagementEntryRegisterApproveInput.approveStatus = 'ApproveSuccess';
        this.SiSTKWEventsManagementEntryRegisterApproveInput.competitionRegistIds = this.SelectionList.map(item => item.id);
        const _confirmStr = '是否批量通过已勾选的运动员？';
        this.$confirm(_confirmStr, translateByCode('alert.warning'), {
          confirmButtonText: translateByCode('alert.confirm'),
          cancelButtonText: translateByCode('alert.cancel'),
          type: 'warning'
        }).then(() => {
          api_POST_EventsManagementEntryApproveCompetitionRegisters(this.SiSTKWEventsManagementEntryRegisterApproveInput).then(res => {
            this.$message({
              type: 'success',
              // 操作成功！
              message: '操作成功！'
            });
            this.refreshList(this.Api_GET_EventsManagementEntryByPersonForAdminQO.Page);
          });
        });
      } else {
        this.$message({
          // 请选择运动员
          message: '请选择运动员',
          type: 'warning'
        });
      }
    },
    // 批量不通过按钮
    clickBatchNoPass() {
      if (this.SelectionList.length > 0) {
        this.SiSTKWEventsManagementEntryRegisterApproveInput = new SiSTKWEventsManagementEntryRegisterApproveInput();
        this.SiSTKWEventsManagementEntryRegisterApproveInput.competitionId = this.gameId;
        this.SiSTKWEventsManagementEntryRegisterApproveInput.approveStatus = 'ApproveFailed';
        this.SiSTKWEventsManagementEntryRegisterApproveInput.competitionRegistIds = this.SelectionList.map(item => item.id);
        const _confirmStr = '是否批量不通过已勾选的运动员？';
        this.$confirm(_confirmStr, translateByCode('alert.warning'), {
          confirmButtonText: translateByCode('alert.confirm'),
          cancelButtonText: translateByCode('alert.cancel'),
          type: 'warning'
        }).then(() => {
          api_POST_EventsManagementEntryApproveCompetitionRegisters(this.SiSTKWEventsManagementEntryRegisterApproveInput).then(res => {
            this.$message({
              type: 'success',
              // 操作成功！
              message: '操作成功！'
            });
            this.refreshList(this.Api_GET_EventsManagementEntryByPersonForAdminQO.Page);
          })
            .catch(() => {
            });
        });
      } else {
        this.$message({
          // 请选择运动员
          message: '请选择运动员',
          type: 'warning'
        });
      }
    },
    // 一键通过按钮
    clickAllPass() {
      const _this = this;
      this.SiSTKWEventsManagementEntryRegisterApproveInput = new SiSTKWEventsManagementEntryRegisterApproveInput();
      this.SiSTKWEventsManagementEntryRegisterApproveInput.competitionId = this.gameId;
      this.SiSTKWEventsManagementEntryRegisterApproveInput.approveStatus = 'ApproveSuccess';
      this.SiSTKWEventsManagementEntryRegisterApproveInput.competitionRegistIds = null;
      const _confirmStr = '是否一键全部通过？';
      this.$confirm(_confirmStr, translateByCode('alert.warning'), {
        confirmButtonText: translateByCode('alert.confirm'),
        cancelButtonText: translateByCode('alert.cancel'),
        type: 'warning'
      }).then(() => {
        _this.drawLoading = true;
        _this.drawLoadingText = '一键全部通过中';
        api_POST_EventsManagementEntryApproveCompetitionRegisters(this.SiSTKWEventsManagementEntryRegisterApproveInput).then(res => {
          this.$message({
            type: 'success',
            // 操作成功！
            message: '操作成功！'
          });
          _this.drawLoading = false;
          this.refreshList(this.Api_GET_EventsManagementEntryByPersonForAdminQO.Page);
        });
      });
    },
    // 一键不通过按钮
    clickAllNoPass() {
      const _this = this;
      this.SiSTKWEventsManagementEntryRegisterApproveInput = new SiSTKWEventsManagementEntryRegisterApproveInput();
      this.SiSTKWEventsManagementEntryRegisterApproveInput.competitionId = this.gameId;
      this.SiSTKWEventsManagementEntryRegisterApproveInput.approveStatus = 'ApproveFailed';
      this.SiSTKWEventsManagementEntryRegisterApproveInput.competitionRegistIds = null;
      const _confirmStr = '是否一键全部不通过？';
      this.$confirm(_confirmStr, translateByCode('alert.warning'), {
        confirmButtonText: translateByCode('alert.confirm'),
        cancelButtonText: translateByCode('alert.cancel'),
        type: 'warning'
      }).then(() => {
        _this.drawLoading = true;
        _this.drawLoadingText = '一键全部不通过中';
        api_POST_EventsManagementEntryApproveCompetitionRegisters(this.SiSTKWEventsManagementEntryRegisterApproveInput).then(res => {
          this.$message({
            type: 'success',
            // 操作成功！
            message: '操作成功！'
          });
          _this.drawLoading = false;
          this.refreshList(this.Api_GET_EventsManagementEntryByPersonForAdminQO.Page);
        })
          .catch(() => {
          });
      });
    },
    // 通过按钮
    clickEnable(row) {
      this.loading = true;
      this.SiSTKWEventsManagementEntryRegisterApproveInput = new SiSTKWEventsManagementEntryRegisterApproveInput();
      this.SiSTKWEventsManagementEntryRegisterApproveInput.competitionId = this.gameId;
      this.SiSTKWEventsManagementEntryRegisterApproveInput.approveStatus = 'ApproveSuccess';
      this.SiSTKWEventsManagementEntryRegisterApproveInput.competitionRegistIds.push(row.id);
      api_POST_EventsManagementEntryApproveCompetitionRegisters(this.SiSTKWEventsManagementEntryRegisterApproveInput).then(res => {
        this.$message({
          type: 'success',
          message: '操作成功！'
        });
        this.refreshList(this.Api_GET_EventsManagementEntryByPersonForAdminQO.Page);
      }, (error) => {
        this.$message({ type: 'error', message: error.error.message });
        this.loading = false;
      });
    },
    // 不通过按钮
    clickDisable(row) {
      this.dialogVisible_ApproveFailed = true;
      this.ApproveFailed_checkList = [];
      this.ApproveFailed_textarea = '';
      this.SiSTKWEventsManagementEntryRegisterApproveInput = new SiSTKWEventsManagementEntryRegisterApproveInput();
      this.SiSTKWEventsManagementEntryRegisterApproveInput.competitionId = this.gameId;
      this.SiSTKWEventsManagementEntryRegisterApproveInput.approveStatus = 'ApproveFailed';
      this.SiSTKWEventsManagementEntryRegisterApproveInput.competitionRegistIds.push(row.id);
    },
    checkListChange(val) {
      const _list = val.filter(item => item.includes('其他问题'));
      this.ApproveFailed_disabled = !(_list.length > 0);
    },
    saveApproveFailed() {
      const _this = this;
      if (_this.ApproveFailed_checkList.length > 0) {
        _this.submitLoading = true;
        const _data_string = _this.ApproveFailed_checkList.join(',');
        this.SiSTKWEventsManagementEntryRegisterApproveInput.approveReasonType = _data_string;
        const _list = _this.ApproveFailed_checkList.filter(item => item !== '其他问题');
        this.SiSTKWEventsManagementEntryRegisterApproveInput.approveReasonDes = _list.join(',') + (_this.ApproveFailed_checkList ? ',' + _this.ApproveFailed_textarea : '');
        console.log('🚀 ~ file: qualification.vue ~ line 1237 ~ saveApproveFailed ~ this.SiSTKWEventsManagementEntryRegisterApproveInput', _this.SiSTKWEventsManagementEntryRegisterApproveInput);
        if (!this.ApproveFailed_disabled && this.ApproveFailed_textarea === '') {
          this.$message({
            message: '请输入其他原因',
            type: 'warning'
          });
          return false;
        }
        api_POST_EventsManagementEntryApproveCompetitionRegisters(_this.SiSTKWEventsManagementEntryRegisterApproveInput).then(res => {
          _this.$message({
            type: 'success',
            message: '保存成功！'
          });
          _this.submitLoading = false;
          _this.dialogVisible_ApproveFailed = false;
          this.refreshList(this.Api_GET_EventsManagementEntryByPersonForAdminQO.Page);
        }, (error) => {
          _this.submitLoading = false;
          _this.dialogVisible_ApproveFailed = false;
          const _msg = error.error.message || error.message;
          this.$message({
            duration: 15000,
            showClose: true,
            message: _msg,
            type: 'error'
          });
        });
      } else {
        this.$message({
          message: '请选择不通过原因',
          type: 'warning'
        });
      }
    },
    // 报项选择弹框
    clickTypeSelect() {
      this.dialogVisible_typeSelect = true;
    },
    // 添加报项
    addAthlete(type) {
      this.dialogVisible_typeSelect = false;
      this.AthleteList = [];
      this.typeSelect = type;
      // 打开弹框时候清空可报名项目列表
      this.eventList = [];
      this.EventsManagementEntryVO = new EventsManagementEntryVO();
      if (this.typeSelect === 'person') {
        this.EventsManagementEntryVO.idCardCode = 'IdCard';
      }
      this.Api_GET_EventsManagementEntryDelegationCandidatesForEntryQO = new Api_GET_EventsManagementEntryDelegationCandidatesForEntryQO();
      this.CreateEntrysInputDTO = new SiSTKWEventsManagementCreateEntrysInput();
      this.dialogVisible_player_new = true;
      this.dialogLoading = false;
    },
    // 新增报项里的机构输入框 筛选
    querySearchDelegation(queryString, cb) {
      var results = queryString ? this.restaurants.filter(this.createStateFilter(queryString)) : this.restaurants;
      this.delegationFliter = results;
      if (this.EventsManagementEntryVO.institutionName === '') {
        // 不选机构的时候清空人员列表
        this.AthleteList = [];
        // 不选机构的时候清空可报名项目列表
        this.eventList = [];
        this.EventsManagementEntryVO.playerName = '';
        this.EventsManagementEntryVO.idCardNumber = '';
      }
      cb(results);
    },
    changeDelegation(val) {
      this.EventsManagementEntryVO.playerName = '';
      this.EventsManagementEntryVO.idCardNumber = '';
      if (!val) {
        // 不选机构的时候清空人员列表
        this.AthleteList = [];
        // 不选机构的时候清空可报名项目列表
        this.eventList = [];
      }
    },
    // 新增报项里的运动员输入框 筛选
    querySearchAthlete(queryString, cb) {
      var restaurants = this.AthleteList;
      this.athleteFliter = restaurants;
      var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants;
      if (this.EventsManagementEntryVO.playerName === '') {
        // 清空可报名项目列表
        this.eventList = [];
        this.EventsManagementEntryVO.idCardNumber = '';
      }
      cb(results);
    },
    changeAthlete(val) {
      this.isDisabled = !val;
      // 清空可报名项目列表
      this.eventList = [];
      this.EventsManagementEntryVO.idCardNumber = '';
      this.EventsManagementEntryVO.imagePath = val ? this.EventsManagementEntryVO.imagePath : '';
    },
    handleSelectDelegation(item) {
      this.Api_GET_EventsManagementEntryDelegationCandidatesForEntryQO.CompetitionId = this.gameId;
      this.Api_GET_EventsManagementEntryDelegationCandidatesForEntryQO.DelegationId = item.id;
      // this.EventsManagementEntryVO.playerName = '';
      this.api_GET_EventsManagementRegister(item.id);
    },
    // 查询注册列表
    api_GET_EventsManagementRegister(delegationId) {
      this.EventsManagementEntryVO.delegationId = delegationId;
      api_GET_EventsManagementRegister({ DelegationId: delegationId, RegisterTags: 'Athlete' }).then(res => {
        this.AthleteList = res.items;
      }, () => {
        this.$message({ type: 'error', message: '查询注册列表失败' });
      });
    },
    createStateFilter(queryString) {
      return (state) => {
        return (state.name && state.name.toLowerCase().indexOf(queryString.toLowerCase()) >= 0);
      };
    },
    // 选中运动员后给身份证输入框赋值
    handleSelectAthlete(item) {
      this.EventsManagementEntryVO.idCardNumber = item.idCardNumber || '';
      this.EventsManagementEntryVO.imagePath = item.imagePath || '';
      // this.EventsManagementEntryVO.delegationId = item.delegationId || '';
      this.EventsManagementEntryVO.registerId = item.id || '';
      this.isDisabled = false;
    },
        // 根据赛事路由获取赛事信息
    getGameInfoByGameRoute() {
      const gameQO = {
        IncludeStatus: true,
        IncludeType: true,
        IncludeApproveStatus: true,
        IncludeLevel: true,
        IncludeSetting: true,
        IncludeReportSetting: true,
        IncludeEntryFields: true
      };
      gameQO.route =  this.gameRouten;
      if (this.gameTenantId) {
        gameQO.__tenant = this.gameTenantId;
      }
      api_GET_EventsManagementCompetitionWithRoute(gameQO).then(res => {
        this.gameInfo = res || {};
      });
    },

    // 根据证件号获取人员信息
    getPersonByIdCard() {
      const _this = this;
      this.isDisabled = true;
      this.$refs.EventsManagementEntryVO.validate(valid => {
        if (valid) {
          this.dialogLoading = true;
          api_GET_EventsManagementRegisterByIdCard({
            idCardCode: this.EventsManagementEntryVO.idCardCode,
            idCardNumber: this.EventsManagementEntryVO.idCardNumber,
            name: this.EventsManagementEntryVO.playerName
          }).then(res => {
            _this.AthleteList = res.items;
            this.EventsManagementEntryVO.imagePath = res.imagePath || '';
            this.EventsManagementEntryVO.registerId = res.id || '';
            // 报名信息检测按钮变成可点击
            this.isDisabled = res === '';
            this.dialogLoading = false;
          }, (error) => {
            _this.$message({ type: 'error', message: error.error.message });
            this.isDisabled = true;
            this.dialogLoading = false;
          });
        } else {
          this.eventList = [];
          this.EventsManagementEntryVO.imagePath = '';
          this.isDisabled = true;
          return false;
        }
      });
    },
    // 获取已存在人员可报的赛事项目列表
    signUpTesting() {
      const _this = this;
      if (this.typeSelect === 'person' || this.delegationFliter.length > 0 && this.athleteFliter.length > 0) {
        this.$refs.EventsManagementEntryVO.validate(valid => {
          if (valid) {
            _this.testingLoading = true;
            this.SiSTKWEventsManagementGetEntryEventsInput.competitionId = this.gameId;
            this.SiSTKWEventsManagementGetEntryEventsInput.registerId = this.EventsManagementEntryVO.registerId;
            // 需要添加单位ID delegationID，个人的时候为空
            this.SiSTKWEventsManagementGetEntryEventsInput.delegationId = this.typeSelect === 'person' ? null : this.EventsManagementEntryVO.delegationId;
            this.SiSTKWEventsManagementGetEntryEventsInput.hasEntriedEvent = true;
            if (_this.parentId && _this.isFinal) {
              _this.getSubCompetitions();
            } else {
              _this.getEntryForRegisters();
            }
          } else {
            return false;
          }
        });
      } else if (this.delegationFliter.length === 0) {
        _this.$message({ type: 'warning', message: '该机构不存在。' });
      } else if (this.athleteFliter.length === 0) {
        _this.$message({ type: 'warning', message: '该运动员不存在' });
      }
    },
    // 获取已存在人员联赛决赛代表的分站赛赛事列表
    getSubCompetitions () {
      const _this = this;
      api_POST_EventsManagementEntryQuerySubCompetitionsToEntryForRegisters(this.SiSTKWEventsManagementGetEntryEventsInput).then(res => {
        _this.radioList = res || [];
        _this.subCompetitionRadioData = _this.radioList.find(item => item.hasUsed) ? _this.radioList.find(item => item.hasUsed).id : '';
        if (_this.radioList.length > 0) {
          _this.getEntryForRegisters();
        } else {
          _this.testingLoading = false;
        }
        console.log('radioList', _this.radioList);
        console.log('subCompetitionRadioData', _this.subCompetitionRadioData);
      }, error => {
        const _msg = error.error.message || error.message;
        _this.$message({ type: 'error', message: _msg });
      });
    },
    getEntryForRegisters () {
      const _this = this;
      api_POST_EventsManagementEntryQueryEventsToEntryForRegisters(this.SiSTKWEventsManagementGetEntryEventsInput).then(res => {
        _this.testingLoading = false;
        _this.OriginalEventList = JSON.parse(JSON.stringify(res)); // 深拷贝常用方法
        console.log('OriginalEventList', _this.OriginalEventList);
        _this.eventList = res;
        for (let i = 0; i < _this.eventList.length; i++) {
          // eslint-disable-next-line prefer-const
          let item = _this.eventList[i];
          if (item.eventRegTypeCode !== 'I') {
            // 测试用 start
            // if (item.id === '655ec212-6e2a-f6cf-953c-39fa2fa249fb') {
            //   item.eventMaxTeamNo = 4; // 测试用
            //   item.delegationUsedTeamNos = [1, 3]; // 测试用
            // } else {
            //   item.eventMaxTeamNo = 6; // 测试用
            //   item.delegationUsedTeamNos = [2, 5]; // 测试用
            // }
            // 测试用 end
            item.isTeam = true;
            item._list = [];
            // 为每个团体小项添加可报队伍数组 _list
            const _eventMaxTeamNo = item.eventMaxTeamNo || 20;
            for (let j = 0; j < _eventMaxTeamNo; j++) {
              if (item.delegationUsedTeamNos) {
                if (item.delegationUsedTeamNos && !item.delegationUsedTeamNos.includes(j + 1)) {
                  item._list.push(j + 1);
                }
              } else {
                item._list.push(j + 1);
              }
            }
          }
        }
        // 聚合数据前提取共同的属性
        _this.eventList.filter(item => {
          item._eventType = item.id;
          item._eventName = item.eventCategoryName;
        });
        // 聚合数据
        _this.eventList = removeSameData(_this.eventList, '_eventName');
        console.log(_this.eventList);
        // 聚合数据前提取共同的属性
        for (let k = 0; k < _this.eventList.length; k++) {
          // eslint-disable-next-line prefer-const
          let ktem = _this.eventList[k];
          ktem.eventCategoryId = ktem.data[0].eventCategoryId;
          // 为团体项目 初始显示 赋值
          if (ktem.data[0].eventRegTypeCode !== 'I') {
            _this.signUpTeamNo[k] = {
              _list: ktem.data[0]._list,
              num: ktem.data[0]._list[0]
            };
          } else {
            _this.signUpTeamNo[k] = {
              _list: [],
              num: ''
            };
          }
          const empty = {
            id: '',
            eventLongName: '不参加'
          };
          _this.signUpList[k] = '';
          ktem.data.unshift(empty);
        }
      }, () => {
        const _msg = error.error.message || error.message;
        _this.$message({ type: 'error', message: _msg });
        this.testingLoading = false;
      });
    },
    // 改变小项下拉
    changeSelectEvent(data, index) {
      const _this = this;
      const _eventData = data.data.filter(item => item.id === this.signUpList[index]);
      // 是团体的时候才做一下操作
      if (_eventData[0].eventRegTypeCode && _eventData[0].eventRegTypeCode !== 'I') {
        console.log('_eventData', _eventData);
        for (let i = 0; i < _this.OriginalEventList.length; i++) {
          const item = _this.OriginalEventList[i];
          item.isTeam = false;
          if (item.id === this.signUpList[index]) {
            item.isTeam = true;
          }
        }
        // this.isTeam = true;
        // 给队伍下拉赋值
        // this.signUpTeamNo[index]._list = _eventData[0]._list;
        // this.$set(this.signUpTeamNo[index], 'num', _eventData[0]._list[0]);
        // this.teamSignUp(this.signUpList[index], data, index);
      }
    },
    changeSelectNum(val, index) {
      this.signUpTeamNo[index].num = val;
      this.$set(this.signUpTeamNo, index, this.signUpTeamNo[index]);
    },
    // 团队报名
    teamSignUp(eventId, item, index) {
      this.isNew = true;
      this.indexByList = index;
      const _data = {
        radioItem: {
          id: eventId,
          RegisterId: this.SiSTKWEventsManagementGetEntryEventsInput.registerId,
          DelegationId: this.SiSTKWEventsManagementGetEntryEventsInput.delegationId
        },
        event: {}
      };
      _data.event = item.data.find(jtem => jtem.id === eventId);
      _data.event.longName = _data.event.eventLongName;
      console.log(this.EventsManagementEntryVO);
      const _obj = {
        id: this.EventsManagementEntryVO.registerId,
        name: this.EventsManagementEntryVO.playerName
      };
      this.mainMember = _obj;
      console.log(this.eventList);
      if (_data.event.weightClasses && _data.event.weightClasses.length > 0) {
        this.entryTeamCompetitionMember(_data);
      } else {
        this.entryTeamNoneCompetitionMember(_data);
      }
    },
    // teamSignUp(eventId, item, index) {
    //   const _this = this;
    //   // this.teamName = '';
    //   this.playerDTO_PersonOfTeam = new PlayerDTO_PersonOfTeam();
    //   const _event = item.data.filter(jtem => jtem.id === eventId);
    //   // 获取团体报项可报的最大最小人数
    //   this.minTeamMembersCount = _event[0].minTeamMembersCount;
    //   this.maxTeamMembersCount = _event[0].maxTeamMembersCount;
    //   this.changeGroupTilteName = _event[0].eventLongName;
    //   console.log(item);
    //   this.isNew = true;
    //   this.Api_GET_EventsManagementEntryDelegationCandidatesForEntryQO.CompetitionId = this.gameId;
    //   this.Api_GET_EventsManagementEntryDelegationCandidatesForEntryQO.EventId = eventId;
    //   this.Api_GET_EventsManagementEntryDelegationCandidatesForEntryQO.HasPhoto = '';
    //   this.Api_GET_EventsManagementEntryDelegationCandidatesForEntryQO.MaxResultCount = 999;
    //   this.dialogVisible_PersonOfTeam = true;
    //   this.dialogLoading_PersonOfTeam = true;
    //   this.personOfTeam_title = '添加组员';
    //   api_GET_EventsManagementEntryDelegationCandidatesForEntry(this.Api_GET_EventsManagementEntryDelegationCandidatesForEntryQO).then(res => {
    //     _this.transferData = res.items;
    //     console.log('🚀 ~ file: qualification.vue ~ line 1433 ~ api_GET_EventsManagementEntryDelegationCandidatesForEntry ~ res.items', res.items);
    //     // 判断是否存在要报项的项目id
    //     // eslint-disable-next-line eqeqeq
    //     if (_this.teamDataObj[eventId] && _this.teamDataObj[eventId].TransferValue == _this.EventsManagementEntryVO.registerId) {
    //       _this.TransferValue = _this.teamDataObj[eventId].TransferValue;
    //       // _this.playerDTO_PersonOfTeam.teamName = _this.teamDataObj[eventId].teamName;
    //     } else {
    //       const _data = {
    //         TransferValue: [],
    //         teamName: ''
    //       };
    //       _this.$set(_this.teamDataObj, eventId, _data);
    //       _this.TransferValue = [_this.EventsManagementEntryVO.registerId];
    //     }
    //     _this.playerDTO_PersonOfTeam.eventId = eventId;
    //     _this.dialogLoading_PersonOfTeam = false;
    //   }, () => {
    //     _this.$message({ type: 'error', message: '获取机构对应赛事可报名人员或项目对应可报名人员' });
    //     _this.dialogLoading_PersonOfTeam = false;
    //   });
    // },
    // 添加新的团体报项
    saveNewPersonOfTeam(eventId) {
      const _this = this;
      this.$refs.playerDTO_PersonOfTeam.validate(valid => {
        if (valid) {
          _this.submitLoading_Person = false;
          _this.dialogVisible_PersonOfTeam = false;
        } else {
          _this.submitLoading_Person = false;
          return false;
        }
      });
    },
    // 更换组员
    changePersonOfTeam (row) {
      // this.teamName = row.delegation.name;
      this.delegationId = row.delegation.id;
      this.groupRadioList = [];
      for (let i = 0; i < row.entrys.length; i++) {
        // eslint-disable-next-line prefer-const
        let radioItem = {
          id: '',
          longName: '',
          teamEntryId: '',
          teamRegisterId: ''
        };
        // eslint-disable-next-line prefer-const
        let item = row.entrys[i];
        this.mainMember = row.sourceRegister;
        if (item.event.registerTypeCode !== 'I') {
          radioItem['id'] = item.event.id;
          radioItem['longName'] = item.event.longName;
          radioItem['teamEntryId'] = item.teamEntry.id;
          radioItem['teamRegisterId'] = item.teamEntry.competitionRegister.id;
          radioItem['weightClasses'] = item.event.weightClasses;
          radioItem['RegisterId'] = row.sourceRegister.id;
          radioItem['DelegationId'] = row.delegation.id;
          item.radioItem = radioItem;
          this.groupRadioList.push(item);
        }
      }
      if (this.groupRadioList.length > 1) {
        this.dialogVisible_group = true;
        this.groupRadio = this.groupRadioList[0].radioItem.id;
        this.changeGroupTilteName = this.groupRadioList[0].radioItem.longName;
      } else {
        this.groupRadio = this.groupRadioList[0].radioItem.id;
        this.changeGroupTilteName = this.groupRadioList[0].radioItem.longName;
        this.checkGroup();
      }
    },
    // 更换组员弹框的值改变
    changeGroupRadio(id) {
      const _this = this;
      this.groupRadioList.filter(item => {
        if (item.radioItem.id === id) {
          // _this.SiSTKWEventsManagementUpdateTeamMemberInput.teamRegisterId = id;
          _this.changeGroupTilteName = item.radioItem.longName;
        }
      });
    },
    // 更换组员的保存
    checkGroup() {
      this.isNew = false;
      const eventItem = this.groupRadioList.find(item => item.radioItem.id === this.groupRadio);
      console.log(eventItem);
      if (eventItem.radioItem.weightClasses && eventItem.radioItem.weightClasses.length > 0) {
        this.entryTeamCompetitionMember(eventItem);
      } else {
        this.entryTeamNoneCompetitionMember(eventItem);
        // 原来正常的更换流程
        // this.maxTeamMembersCount = eventItem ? eventItem.event.maxTeamMembersCount : 0;
        // this.Api_GET_EventsManagementEntryEntryMemberForTeamQO = new Api_GET_EventsManagementEntryEntryMemberForTeamQO();
        // this.Api_GET_EventsManagementEntryEntryMemberForTeamQO.CompetitionId = this.gameId;
        // this.Api_GET_EventsManagementEntryEntryMemberForTeamQO.DelegationId = this.delegationId;
        // this.Api_GET_EventsManagementEntryEntryMemberForTeamQO.EventId = this.groupRadio;
        // this.Api_GET_EventsManagementEntryEntryMemberForTeamQO.TeamId = eventItem.radioItem.teamRegisterId;
        // this.teamEntryId = eventItem.radioItem.teamEntryId;
        // this.Api_GET_EventsManagementEntryDelegationCandidatesForEntryQO = new Api_GET_EventsManagementEntryDelegationCandidatesForEntryQO();
        // this.Api_GET_EventsManagementEntryDelegationCandidatesForEntryQO.CompetitionId = this.gameId;
        // this.Api_GET_EventsManagementEntryDelegationCandidatesForEntryQO.DelegationId = this.delegationId;
        // this.Api_GET_EventsManagementEntryDelegationCandidatesForEntryQO.EventId = this.groupRadio;
        // this.Api_GET_EventsManagementEntryDelegationCandidatesForEntryQO.HasPhoto = '';
        // this.Api_GET_EventsManagementEntryDelegationCandidatesForEntryQO.MaxResultCount = 999;
        // this.dialogVisible_group = false;
        // this.dialogVisible_PersonOfTeam = true;
        // this.dialogLoading = true;
        // this.changePerson();
      }
    },
    // 团体非竞技成员选择
    entryTeamNoneCompetitionMember(data) {
      this.teamNoneCompetitionCurrent = data.event;
      this.teamNoneCompetitionTitle = data.event.longName;
      this.teamNoneCompetitionMaxCount = data.event.maxTeamMembersCount;
      this.teamNoneCompetitionMinCount = data.event.minTeamMembersCount;
      this.requiredIdData = data.radioItem;

      const _promiseEntry = this.getTeamEntry({
        EventId: data.radioItem.id,
        RegisterId: data.radioItem.RegisterId,
        DelegationId: data.radioItem.DelegationId
      });

      const _promiseEntryMember = this.getTeamEntryMemberCandidates({
        EventId: data.radioItem.id,
        DelegationId: data.radioItem.DelegationId
      });
      Promise.all([_promiseEntry, _promiseEntryMember])
        .then(
          res => {
            const teamEntryRes = res[0];
            const teamEntryMemberCandidatesRes = res[1];
            this.teamNoneCompetitionTeamEntry = teamEntryRes;
            const _teamName = teamEntryRes.teamNo ? teamEntryRes.teamNo + '组' : '';
            this.teamNoneCompetitionTitle = `${this.teamNoneCompetitionTitle} ${_teamName}`;
            this.teamNoneCompetitionLeftList = teamEntryMemberCandidatesRes;
            this.teamNoneCompetitionRightList = teamEntryRes.members;
            this.$refs.refTeamNoneCompetitionMember.open();
          }
        )
        .catch(
          error => {
            console.log('error: ', error);
          }
        );
    },
    // 团体竞技成员选择
    entryTeamCompetitionMember(data) {
      console.log(data);
      this.teamCompetitionCurrent = data.event;
      this.teamCompetitionTitle = data.event.longName;
      this.teamCompetitionMaxCount = data.event.maxTeamMembersCount;
      this.teamCompetitionMinCount = data.event.minTeamMembersCount;
      this.requiredIdData = data.radioItem;

      const _promiseEntry = this.getTeamEntry({
        EventId: data.radioItem.id,
        RegisterId: data.radioItem.RegisterId,
        DelegationId: data.radioItem.DelegationId
      });

      const _promiseEntryMember = this.getTeamEntryMemberCandidates({
        EventId: data.radioItem.id,
        DelegationId: data.radioItem.DelegationId
      });

      Promise.all([_promiseEntry, _promiseEntryMember])
        .then(
          res => {
            const teamEntryRes = res[0];
            const teamEntryMemberCandidatesRes = res[1];

            this.teamCompetitionTeamEntry = teamEntryRes;
            const _teamName = teamEntryRes.teamNo ? teamEntryRes.teamNo + '组' : '';
            this.teamCompetitionTitle = `${this.teamCompetitionTitle} ${_teamName}`;
            this.teamCompetitionLeftList = teamEntryMemberCandidatesRes;
            if (data.event.weightClasses) {
              data.event.weightClasses.sort((a, b) => a.sortOrder - b.sortOrder);
            }
            this.teamCompetitionRightList = this.formatWeightClasses(data.event, teamEntryRes.members);
            this.$refs.refTeamCompetitionMember.open();
          }
        )
        .catch(
          error => {
            console.log('error: ', error);
          }
        );
    },
    // 获取团体报项候选人员列表
    getTeamEntryMemberCandidates (qo) {
      return new Promise((reslove, reject) => {
        api_GET_EventsManagementEntryTeamEntryMemberCandidates(qo)
          .then(
            res => {
              reslove(res);
            }
          )
          .catch(
            error => {
              this.$message({
                message: `获取团体报项候选人员列表失败 ${error.error.message}`,
                type: 'error',
                showClose: true
              });
              reject(error);
            }
          );
      });
    },
    // 获取团体报项API
    getTeamEntry(qo) {
      return new Promise((reslove, reject) => {
        api_GET_EventsManagementEntryTeamEntry(qo)
          .then(
            res => {
              reslove(res);
            }
          )
          .catch(
            error => {
              reject(error);
              this.$message({
                message: `获取团体报项失败 ${error.error.message}`,
                type: 'error',
                showClose: true
              });
            }
          );
      });
    },
    formatWeightClasses (data, members) {
      members = members || [];
      const _rightList = JSON.parse(JSON.stringify(data.weightClasses));

      for (let i = 0; i < _rightList.length; i++) {
        const item = _rightList[i];
        item._children = members.filter(jtem => jtem.eventWeightClassId === item.id);
      }
      return _rightList;
    },
    // 团体竞技报名
    onTeamCompetitionSubmit (data) {
      const _ids = data.map(item => {
        return {
          registerIds: item._children.map(jtem => jtem.registerId || jtem.id)
        };
      });
      this.submitTeamEntry({
        eventId: this.teamCompetitionCurrent.id,
        delegationId: this.requiredIdData.DelegationId,
        entryId: this.teamCompetitionTeamEntry.teamEntryId || '',
        teamNo: this.teamCompetitionTeamEntry.teamNo,
        weightClasses: _ids
      }, 'TeamCompetition');
    },
    // 团体非竞技确认报名
    onTeamNoneCompetitionSubmit (data) {
      const _ids = data.map(item => item.registerId || item.id);
      this.submitTeamEntry({
        eventId: this.teamNoneCompetitionCurrent.id,
        delegationId: this.requiredIdData.DelegationId,
        entryId: this.teamNoneCompetitionTeamEntry.teamEntryId || '',
        teamNo: this.teamNoneCompetitionTeamEntry.teamNo,
        weightClasses: [{ registerIds: _ids }]
      }, 'TeamNoneCompetition');
    },
    // 保存团体报项API
    submitTeamEntry(vo, type) {
      const _this = this;
      api_POST_EventsManagementEntrySaveTeamEntry2(vo)
        .then(
          res => {
            this.refreshList(this.Api_GET_EventsManagementEntryByPersonForAdminQO.Page);
            if (type === 'TeamCompetition') {
              this.$refs.refTeamCompetitionMember.close();
            }
            if (type === 'TeamNoneCompetition') {
              this.$refs.refTeamNoneCompetitionMember.close();
            }
            if (_this.isNew) {
              this.$delete(_this.eventList, _this.indexByList);
              this.$delete(_this.signUpList, _this.indexByList);
              console.log('$delete', _this.eventList);
            }
            this.$message({
              message: `保存团体报项成功`,
              type: 'success',
              showClose: true
            });
          }
        )
        .catch(
          error => {
            if (type === 'TeamCompetition') {
              this.$refs.refTeamCompetitionMember.hideLoading();
            }
            if (type === 'TeamNoneCompetition') {
              this.$refs.refTeamNoneCompetitionMember.hideLoading();
            }
            this.$message({
              message: `保存团体报项失败 ${error.error.message}`,
              type: 'error',
              showClose: true
            });
          }
        );
    },
    onDeleteGroupCompetition () {
      this.onDeleteGroupMember(this.teamCompetitionTeamEntry.teamEntryId, this.teamCompetitionCurrent.id, 'TeamCompetition');
    },
    onDeleteGroupNoneCompetition () {
      this.onDeleteGroupMember(this.teamNoneCompetitionTeamEntry.teamEntryId, this.teamNoneCompetitionCurrent.id, 'TeamNoneCompetition');
    },
    // 删除整组成员
    onDeleteGroupMember (teamId, id, type) {
      const _this = this;
      api_DELETE_EventsManagementEntryTeamEntry({
        EntryId: teamId,
        DelegationId: this.requiredIdData.DelegationId,
        EventId: id
      })
        .then(
          res => {
            this.refreshList(this.Api_GET_EventsManagementEntryByPersonForAdminQO.Page);
            if (type === 'TeamCompetition') {
              this.$refs.refTeamCompetitionMember.close();
            }
            if (type === 'TeamNoneCompetition') {
              this.$refs.refTeamNoneCompetitionMember.close();
            }
            this.$message({
              message: `删除团体报项成功`,
              type: 'success',
              showClose: true
            });
            _this.dialogVisible_group = false;
          }
        )
        .catch(
          error => {
            if (type === 'TeamCompetition') {
              this.$refs.refTeamCompetitionMember.hideLoading();
            }
            if (type === 'TeamNoneCompetition') {
              this.$refs.refTeamNoneCompetitionMember.hideLoading();
            }
            const _msg = error.error.message || error.message;
            this.$message({
              message: `删除团体报项失败 ${_msg}`,
              type: 'error',
              showClose: true
            });
          }
        );
    },
    // 更换人员
    changePerson () {
      const _this = this;
      // 获取人员数据
      _this.dialogLoading_PersonOfTeam = true;
      this.personOfTeam_title = '更换组员';
      _this.TransferValue = [];
      const a = api_GET_EventsManagementEntryEntryMemberForTeam(this.Api_GET_EventsManagementEntryEntryMemberForTeamQO);
      const b = api_GET_EventsManagementEntryDelegationCandidatesForEntry(this.Api_GET_EventsManagementEntryDelegationCandidatesForEntryQO);
      Promise.all([a, b]).then(res => {
        // 已报名人员
        res[0].items.filter(item => {
          _this.TransferValue.push(item.id);
        });
        // 组合所有人员
        _this.transferData = [...res[0].items, ...res[1].items];
        _this.dialogLoading_PersonOfTeam = false;
      }, (error) => {
        _this.dialogLoading_PersonOfTeam = false;
        this.$message({ type: 'error', message: error.error.message });
      });
    },
    // 保存报项人员
    savePersonOfTeam () {
      const _this = this;
      _this.submitLoading_Person = true;
      if (_this.TransferValue.length > 0) {
        _this.SiSTKWEventsManagementUpdateTeamMemberInput = new SiSTKWEventsManagementUpdateTeamMemberInput();
        _this.SiSTKWEventsManagementUpdateTeamMemberInput.teamRegisterId = _this.Api_GET_EventsManagementEntryEntryMemberForTeamQO.TeamId;
        _this.SiSTKWEventsManagementUpdateTeamMemberInput.memberRegisterIds = _this.TransferValue;
        api_PUT_EventsManagementEntryTeamMemberForAdmin(_this.SiSTKWEventsManagementUpdateTeamMemberInput).then(res => {
          _this.$message({
            type: 'success',
            message: translateByCode('alert.editSuccessfully')
          });
          _this.submitLoading = false;
          _this.submitLoading_Person = false;
          _this.dialogVisible_PersonOfTeam = false;
          _this.refreshList();
        }, (error) => {
          _this.submitLoading = false;
          _this.submitLoading_Person = false;
          _this.dialogVisible_PersonOfTeam = false;
          _this.$message({ type: 'error', message: error.error.message });
        });
      } else {
        api_DELETE_EventsManagementEntryForAdmin({ ids: [this.teamEntryId] }).then(res => {
          _this.$message({
            type: 'success',
            message: translateByCode('alert.editSuccessfully')
          });
          _this.submitLoading = false;
          _this.submitLoading_Person = false;
          _this.dialogVisible_PersonOfTeam = false;
          _this.refreshList();
        }, (error) => {
          _this.submitLoading = false;
          _this.submitLoading_Person = false;
          _this.dialogVisible_PersonOfTeam = false;
          _this.$message({ type: 'error', message: error.error.message });
        });
      }
    },
    // 添加报项
    saveNew() {
      const _this = this;
      _this.submitLoading = true;
      this.$refs.EventsManagementEntryVO.validate(valid => {
        if (valid) {
          // 根据下拉的小项id找到小项数据
          _this.CreateEntrysInputDTO = new SiSTKWEventsManagementCreateEntrysInput();
          _this.CreateEntrysInputDTO.competitionId = _this.gameId;
          _this.CreateEntrysInputDTO.delegationId = _this.EventsManagementEntryVO.delegationId || null;
          if (_this.parentId && _this.isFinal) {
            _this.CreateEntrysInputDTO.subCompetitionId = _this.subCompetitionRadioData || null;
            if (!_this.CreateEntrysInputDTO.subCompetitionId) {
              this.$message({ type: 'warning', message: '请选择赛区！' });
              _this.submitLoading = false;
              return;
            }
          }
          for (let i = 0; i < _this.signUpList.length; i++) {
            const item = _this.signUpList[i];
            const _data = _this.OriginalEventList.find(jtem => item === jtem.id);
            if (item !== '') {
              _this.SiSTKWEventsManagementCreateEntryInput = new SiSTKWEventsManagementCreateEntryInput();
              _this.SiSTKWEventsManagementCreateEntryInput.eventId = item;
              // 报项不是个人的时候取多个registerIds，个人只取本人  teamDataObj
              if (_data.eventRegTypeCode !== 'I') {
                if (_data.isTeam) {
                  _this.$message({
                    message: '请添加团体报名',
                    type: 'warning'
                  });
                  _this.submitLoading = false;
                  _this.submitLoading_Person = false;
                  return;
                }
              } else {
                _this.SiSTKWEventsManagementCreateEntryInput.registerIds = [_this.EventsManagementEntryVO.registerId];
                _this.SiSTKWEventsManagementCreateEntryInput.teamName = null;
                _this.SiSTKWEventsManagementCreateEntryInput.teamNo = null;
              }
              _this.CreateEntrysInputDTO.entrys.push(_this.SiSTKWEventsManagementCreateEntryInput);
            }
          }
          if (_this.CreateEntrysInputDTO.entrys.length === 0) {
            _this.$message({
              message: '请选择报项',
              type: 'warning'
            });
            _this.submitLoading = false;
            _this.submitLoading_Person = false;
          } else {
            api_POST_EventsManagementEntryForAdmin(_this.CreateEntrysInputDTO).then(res => {
              _this.$message({
                type: 'success',
                message: translateByCode('alert.editSuccessfully')
              });
              _this.submitLoading = false;
              _this.submitLoading_Person = false;
              _this.dialogVisible_player_new = false;
            }, (error) => {
              _this.submitLoading = false;
              _this.submitLoading_Person = false;
              _this.signUpTesting();
              this.$message({
                duration: 15000,
                showClose: true,
                message: error.error.message,
                type: 'error'
              });
            });
          }
        } else {
          _this.submitLoading = false;
          return false;
        }
      });
    },
    // 报名接口
    apiEventEntry(vo) {
      return new Promise((resolve, reject) => {
        api_POST_EventsManagementEntryForAdmin(vo)
          .then(
            res => {
              resolve(res);
            }
          )
          .catch(
            error => {
              reject(error);
            }
          );
      });
    },
    // 打开更换赛区弹框
    openSubCompetition (row) {
      const _this = this;
      _this.dialogVisible_subCompetition = true;
      _this.dialogLoading = true;
      _this.SiSTKWEventsManagementGetEntryEventsInput = new SiSTKWEventsManagementGetEntryEventsInput();
      _this.SiSTKWEventsManagementGetEntryEventsInput.competitionId = this.gameId;
      _this.SiSTKWEventsManagementGetEntryEventsInput.registerId = row.sourceRegister.id;
      _this.SiSTKWEventsManagementGetEntryEventsInput.delegationId = row.sourceRegister.delegationId;
      _this.SiSTKWEventsManagementGetEntryEventsInput.hasEntriedEvent = true;
      api_POST_EventsManagementEntryQuerySubCompetitionsToEntryForRegisters(this.SiSTKWEventsManagementGetEntryEventsInput).then(res => {
        _this.radioList = res || [];
        _this.subCompetitionQO.subCompetitionId = row.subCompetition.id;
        _this.subCompetitionQO.competitionRegisterId = row.id;
        console.log('radioList', _this.radioList);
        console.log('subCompetitionRadioData', _this.subCompetitionRadioData);
        _this.dialogLoading = false;
      }, error => {
        const _msg = error.error.message || error.message;
        _this.$message({ type: 'error', message: _msg });
        _this.dialogLoading = false;
      });
    },
    // 更换赛区
    saveSubCompetition () {
      const _this = this;
      _this.submitLoading = true;
      api_PUT_EventsManagementEntryComRegisterSubCompetition(this.subCompetitionQO).then(res => {
        _this.$message({ type: 'success', message: '修改成功！' });
        _this.submitLoading = false;
        _this.dialogVisible_subCompetition = false;
        _this.refreshList(_this.Api_GET_EventsManagementEntryByPersonForAdminQO.Page);
      }, error => {
        _this.submitLoading = false;
        const _msg = error.error.message || error.message;
        _this.$message({ type: 'error', message: _msg });
      });
    },
    // 生成比赛记录单
    comRecord(ContestResults) {
      const _this = this;
      const reportVO = {};
      reportVO.reportName = ContestResults;
      reportVO.format = 'PDF';
      reportVO.CompetitionId = this.gameId;
      let fileName = '';
      if (ContestResults === 'EntryListByEvent') {
        fileName = '报名表(按级别)' + '.pdf';
        reportVO.EventId = this.eventId;
      } else {
        fileName = '报名表(按机构)' + '.pdf';
      }
      const tempUrl = `/api/app/events-management/report`;
      _this.downloadResultLoading = true;
      api_GET_DownLoadFileAddHeader(tempUrl, fileName, reportVO).then(res => {
        _this.downloadResultLoading = false;
      }).catch(error => {
        _this.downloadResultLoading = false;
        errorText(error).then(function(text) {
          _this.$message({ type: 'error', message: text });
        });
      });
    },
    // 生成excel表
    downLoadLevelChange(name) {
      const _this = this;
      this.downloadResultLoading = true;
      const tempUrl = `/api/excel`;
      const fileName = '资格审查不通过表.xlsx';
      api_GET_DownLoadFileAddHeader(tempUrl, fileName, { ReportName: name, CompetitionId: this.gameId, ApproveStatusCode: 'ApproveFailed' }).then(res => {
        _this.downloadResultLoading = false;
      }).catch(error => {
        _this.downloadResultLoading = false;
        errorText(error).then(function(text) {
          _this.$message({ type: 'error', message: text });
        });
      });
    },
    // 生成excel级别变更表
    downExcelEntryChange(name) {
      const _this = this;
      this.downloadResultLoading = true;
      const tempUrl = `/api/excel`;
      const fileName = '级别变更表.xlsx';
      const _vo = {
        ReportName: name,
        CompetitionId: this.$route.params.id,
        ProviderNames: 'M' // 修改的动作来源：M修改报项；C合并项目；S拆分项目
      };
      api_GET_DownLoadFileAddHeader(tempUrl, fileName, _vo).then(res => {
        _this.downloadResultLoading = false;
      }).catch(error => {
        _this.downloadResultLoading = false;
        errorText(error).then(function(text) {
          _this.$message({ type: 'error', message: text });
        });
      });
      // this.downloadResultLoading = false;
    },
    sizeChange(MaxResultCount) {
      this.Api_GET_EventsManagementEntryByPersonForAdminQO.MaxResultCount = MaxResultCount;
      this.refreshList();
    },
    pageIndexChange(currentPage) {
      this.refreshList(currentPage);
    },
    sortData (data) {
      // 排序_sortObj
      const _data = data.sort((a, b) => a.sortOrder - b.sortOrder);
      return _data;
    }
  }
};
</script>
<style lang="scss">
  .PDFimg{
    height: 28px;
    width: 25px;
    vertical-align: middle;
  }
  .pdf_btn{
    cursor: pointer;
    display: inline-block;
  }
  .pdf_btn>span{
    padding-left: 5px;
    display: inline-block;
    vertical-align: middle;
  }
  .pdf_btn:hover span{
    color: #1890ff;
  }
  .transferBox .el-transfer-panel__header{
    pointer-events:none
  }
  .transferBox .el-transfer-panel{
    width: 625px;
  }
  .transferBox .el-transfer-panel__header .el-checkbox__input{
    display: none;
  }
  .transferBox .el-transfer-panel__item{
    height: 80px;
    line-height: 80px;
    margin: 0 10px;
    border-bottom: 1px solid #dfe6ec;
  }
  .transferBox .el-transfer-panel__body,.transferBox .el-transfer-panel__list{
    height: 430px;
  }
  .transferUl li{
    float: left;
    height: 70px;
    line-height: 70px;
    margin-right: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .transferBox .el-transfer-panel__item .el-checkbox__input{
    top: 29px;
  }
  .transferBox .transferUl .el-transfer-panel__item.el-checkbox .el-checkbox__label{
    display: inline-block;
    vertical-align: middle;
  }
  .transferUl .transferItem_img img{
    width:52px;
    height: 66px;
    vertical-align: middle;
  }
  .transferUl .transferItem_name{
    width:90px;
  }
  .transferUl .transferItem_gender{
    width:35px;
  }
  .transferUl .transferItem_idCard{
    width:195px;
  }
  .transferUl .transferItem_institutionName{
    width:140px;
  }
  .transferUl .transferItem_phone{
    width:130px;
  }
  .athletePhoto{
    width: 60px;
    height: 70px;
    vertical-align: middle;
  }
</style>
<style scoped>
.fixHeight {
  height: 500px;
}
.fileImgBox{
  width: 260px;
  height: 410px;
  margin: 0 5px 15px 5px;
  border: 1px solid #D2D2D2;
  border-radius: 6px;
  overflow: hidden;
}
.fileImg {
  width: 100%;
  height: 100%;
}
.testingBtn_box {
  padding-bottom: 15px;
}
.gameListBox{
  border: 1px dashed #ffba00;
  padding: 30px 20px 0 20px;
  border-radius: 6px;
  min-height: 300px;
}
.editAthleteBox{
    display: inline-block;
    vertical-align: middle;
    margin-right: 15px;
}
.uploadBox{
  width: 200px;
  height: 200px;
}
.uploadBox_people{
  height: 100%;
  width: 100%;
}
.teamName{
  font-size: 16px;
  text-align: center;
  font-weight: bold;
  margin-bottom: 35px;
}
.typeSelect_card{
  cursor: pointer;
  text-align: center;
  line-height: 70px;
  font-size: 26px;
}
.typeSelect_card:hover{
  background: #e8f4ff;
}
.radio /deep/ .el-radio__label{
  width: 500px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}
</style>
